Tuesday, February 14, 2017

Sample ESB sequence and Inbound to receive the message from the queue using the ESB Amazon SQS streaming connector and then send that message into another queue using the ESB Amazon SQS connector

Sample ESB Sequence

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="request" onError="fault" xmlns="http://ws.apache.org/ns/synapse">
    <log level="custom">
        <property expression="$body/*" name="------------" xmlns:ns="http://org.apache.synapse/xsd"/>
    </log>
    <property name="POST_TO_URI" scope="axis2" value="true"/>
    <call blocking="true">
        <endpoint>
            <http method="GET" uri-template="https://httpbin.org/get"/>
        </endpoint>
    </call>
    <property expression="$body/*" name="messageBody" xmlns:ns="http://org.apache.synapse/xsd"/>
    <amazonsqs.init>
        <secretAccessKey>xxxxxxxxxxxxxxxxxxxxx</secretAccessKey>
        <accessKeyId>xxxxxxxxxxxxxxxxxxxxx</accessKeyId>
        <version>2009-02-01</version>
        <region>us-east-1</region>
    </amazonsqs.init>
    <amazonsqs.sendMessage>
        <queueId>141823495686</queueId>
        <queueName>SQS_Inbound</queueName>
        <messageBody>{$ctx:messageBody}</messageBody>
    </amazonsqs.sendMessage>
</sequence>

Sample ESB Inbound

<?xml version="1.0" encoding="UTF-8"?>
<inboundEndpoint xmlns="http://ws.apache.org/ns/synapse"
                 name="amazon"
                 sequence="request"
                 onError="fault"
                 class="org.wso2.carbon.inbound.amazonsqs.AmazonSQSPollingConsumer"
                 suspend="false">
   <parameters>
      <parameter name="inbound.behavior">polling</parameter>
      <parameter name="interval">2000</parameter>
      <parameter name="sequential">true</parameter>
      <parameter name="coordination">true</parameter>
      <parameter name="attributeNames">attributeName1,contentType</parameter>
      <parameter name="accessKey">xxxxxxxxxxxxxxxxxxxxxxxxxx</parameter>
      <parameter name="waitTime">19</parameter>
      <parameter name="maxNoOfMessage">10</parameter>
      <parameter name="secretKey">xxxxxxxxxxxxxxxxxxxxxxxxxxxx</parameter>
      <parameter name="contentType">text/plain</parameter>
      <parameter name="destination">https://sqs.us-east-1.amazonaws.com/141823495686/SQS_Queue</parameter>
   </parameters>
</inboundEndpoint>

No comments:

Post a Comment