Search in sources :

Example 1 with SqsFifoQueueActionMsg

use of org.thingsboard.server.extensions.sqs.action.fifo.SqsFifoQueueActionMsg in project thingsboard by thingsboard.

the class SqsMessageHandler method sendMessageToFifoQueue.

private void sendMessageToFifoQueue(PluginContext ctx, TenantId tenantId, RuleId ruleId, RuleToPluginMsg<?> msg) {
    SqsFifoQueueActionPayload payload = ((SqsFifoQueueActionMsg) msg).getPayload();
    SendMessageRequest sendMsgRequest = new SendMessageRequest().withQueueUrl(payload.getQueue()).withMessageBody(payload.getMsgBody()).withMessageGroupId(payload.getDeviceId());
    sqs.sendMessage(sendMsgRequest);
    if (payload.isSync()) {
        ctx.reply(new ResponsePluginToRuleMsg(msg.getUid(), tenantId, ruleId, BasicStatusCodeResponse.onSuccess(payload.getMsgType(), payload.getRequestId())));
    }
}
Also used : SqsFifoQueueActionMsg(org.thingsboard.server.extensions.sqs.action.fifo.SqsFifoQueueActionMsg) ResponsePluginToRuleMsg(org.thingsboard.server.extensions.api.plugins.msg.ResponsePluginToRuleMsg) SqsFifoQueueActionPayload(org.thingsboard.server.extensions.sqs.action.fifo.SqsFifoQueueActionPayload) SendMessageRequest(com.amazonaws.services.sqs.model.SendMessageRequest)

Aggregations

SendMessageRequest (com.amazonaws.services.sqs.model.SendMessageRequest)1 ResponsePluginToRuleMsg (org.thingsboard.server.extensions.api.plugins.msg.ResponsePluginToRuleMsg)1 SqsFifoQueueActionMsg (org.thingsboard.server.extensions.sqs.action.fifo.SqsFifoQueueActionMsg)1 SqsFifoQueueActionPayload (org.thingsboard.server.extensions.sqs.action.fifo.SqsFifoQueueActionPayload)1