use of org.thingsboard.server.extensions.sns.action.SnsTopicActionPayload in project thingsboard by thingsboard.
the class SnsMessageHandler method process.
@Override
public void process(PluginContext ctx, TenantId tenantId, RuleId ruleId, RuleToPluginMsg<?> msg) throws RuleException {
if (msg instanceof SnsTopicActionMsg) {
SnsTopicActionPayload payload = ((SnsTopicActionMsg) msg).getPayload();
PublishRequest publishRequest = new PublishRequest().withTopicArn(payload.getTopicArn()).withMessage(payload.getMsgBody());
sns.publish(publishRequest);
if (payload.isSync()) {
ctx.reply(new ResponsePluginToRuleMsg(msg.getUid(), tenantId, ruleId, BasicStatusCodeResponse.onSuccess(payload.getMsgType(), payload.getRequestId())));
}
return;
}
throw new RuleException("Unsupported message type " + msg.getClass().getName() + "!");
}
Aggregations