Search in sources :

Example 1 with SqsStandardQueueActionPayload

use of org.thingsboard.server.extensions.sqs.action.standard.SqsStandardQueueActionPayload in project thingsboard by thingsboard.

the class SqsMessageHandler method sendMessageToStandardQueue.

private void sendMessageToStandardQueue(PluginContext ctx, TenantId tenantId, RuleId ruleId, RuleToPluginMsg<?> msg) {
    SqsStandardQueueActionPayload payload = ((SqsStandardQueueActionMsg) msg).getPayload();
    SendMessageRequest sendMsgRequest = new SendMessageRequest().withDelaySeconds(payload.getDelaySeconds()).withQueueUrl(payload.getQueue()).withMessageBody(payload.getMsgBody());
    sqs.sendMessage(sendMsgRequest);
    if (payload.isSync()) {
        ctx.reply(new ResponsePluginToRuleMsg(msg.getUid(), tenantId, ruleId, BasicStatusCodeResponse.onSuccess(payload.getMsgType(), payload.getRequestId())));
    }
}
Also used : SqsStandardQueueActionMsg(org.thingsboard.server.extensions.sqs.action.standard.SqsStandardQueueActionMsg) SqsStandardQueueActionPayload(org.thingsboard.server.extensions.sqs.action.standard.SqsStandardQueueActionPayload) ResponsePluginToRuleMsg(org.thingsboard.server.extensions.api.plugins.msg.ResponsePluginToRuleMsg) 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 SqsStandardQueueActionMsg (org.thingsboard.server.extensions.sqs.action.standard.SqsStandardQueueActionMsg)1 SqsStandardQueueActionPayload (org.thingsboard.server.extensions.sqs.action.standard.SqsStandardQueueActionPayload)1