Package com.threepillar.labs.si.aws

Examples of com.threepillar.labs.si.aws.MessagePacket


   * Executes the outbound Sqs Operation.
   *
   */
  public Object executeOutboundOperation(final Message<?> message) {

    MessagePacket packet = new MessagePacket(message);
    if (queue == null) {
      SendMessageRequest request = new SendMessageRequest(queueUrl,
          packet.toJSON());
      SendMessageResult result = sqsClient.sendMessage(request);
      log.debug("Message sent, Id:" + result.getMessageId());
    } else {
      queue.add(packet.toJSON());
    }

    return message.getPayload();

  }
View Full Code Here


        JSONObject qMessageJSON = new JSONObject(payloadJSON);
        if (qMessageJSON.has(SNS_MESSAGE_KEY)) { // posted from SNS
          payloadJSON = qMessageJSON.getString(SNS_MESSAGE_KEY);
          // XXX: other SNS attributes?
        }
        MessagePacket packet = MessagePacket.fromJSON(payloadJSON);
        MessageBuilder<?> builder = MessageBuilder.fromMessage(packet
            .assemble());
        if (qMessage != null) {
          builder.setHeader(SqsHeaders.MSG_RECEIPT_HANDLE,
              qMessage.getReceiptHandle());
          builder.setHeader(SqsHeaders.AWS_MESSAGE_ID,
View Full Code Here

   * Executes the outbound Sns Operation.
   *
   */
  public Object executeOutboundOperation(final Message<?> message) {

    MessagePacket packet = new MessagePacket(message);
    if (snsTestProxy == null) {
      PublishRequest request = new PublishRequest();
      PublishResult result = client.publish(request
          .withTopicArn(topicArn).withMessage(packet.toJSON()));
      log.debug("Published message to topic: " + result.getMessageId());
    } else {
      snsTestProxy.dispatchMessage(packet.toJSON());
    }

    return message.getPayload();

  }
View Full Code Here

public abstract class NotificationHandler {

  protected abstract void dispatch(Message<?> message);

  public void onNotification(String notification) {
    MessagePacket packet = MessagePacket.fromJSON(notification);
    dispatch(packet.assemble());
  }
View Full Code Here

TOP

Related Classes of com.threepillar.labs.si.aws.MessagePacket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.