Hi,

I have the following requirement -

1) If a message is received on the save entity route and the authentication
server is not available, then queue up the request in the
*periodicallyPolledInputQueue*.
2) The *periodicallyPolledInputQueue* thus may have n number of messages.
3) Every 30 minutes fetch all the messages in the
*periodicallyPolledInputQueue* and queue them back up to the *saveEntity*
queue using a producer template in the processor
*periodicallyPolledInputHandler* 


<route id="saveEntityRoute"
errorHandlerRef="PeriodicallyPolledInputQueue-ErrorHandler" trace="true">
  <from uri="jms:queue:JMS-Server/saveEntity?concurrentConsumers=10" />
  <camel:transacted ref="PROPAGATION_REQUIRED"/>
  <process ref="authenticator" />
  <camel:choice>
    <camel:when>
      
      <camel:simple>${header.SESSION_ID} == null and
${header.SERVER_AVAILABLE_TOKEN} == 'NO'</camel:simple>
      <to
uri="jms:queue:JMS-Server/periodicallyPolledInputQueue?disableReplyTo=true"
/>
    </camel:when>
    <camel:when>
      
      
      <camel:simple>${header.SESSION_ID} == null and
${header.SERVER_AVAILABLE_TOKEN} != 'NO'</camel:simple>
      <camel:stop></camel:stop>
    </camel:when>
    <camel:otherwise>
      <to uri="xslt:xsl/Transform.xsl" />
      <convertBodyTo type="java.lang.String"/>
      <delay><constant>300</constant></delay>
      <to uri="bean:entityData?method=saveEntity(${body},
${header.SESSION_ID}, ${header.ACK_ID})"/>
      <to uri="jms:queue:JMS-Server/saveEntityAck?disableReplyTo=true" />
    </camel:otherwise>
  </camel:choice>
</route>


<route id="periodicallyPolledInputQueueHandlerRoute">
  <from
uri="quartz://periodicallyPolledInputQueueHandler?cron=0+0/30+*+*+*+?"/>
  <camel:transacted ref="PROPAGATION_REQUIRED"/>
  <pollEnrich
uri="jms:queue:JMS-Server/periodicallyPolledInputQueue?disableReplyTo=true"/>
  <process ref="periodicallyPolledInputHandler" />
</route>

The goal is to  setup a fail-safe system that would ensure that the
integration layer is available even if the authentication system is down and
we can reprocess the messages.

The questions now -
1) Is this approach correct.
2) I tested this works but strangely just picks a single message only from
the input queue "periodicallyPolledInputQueue" even if tehre are n messages
lying. Is this teh behaviour of quarts+pollenrich on JMS?

Thanks.



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-To-implement-a-periodically-polled-queue-tp5719920.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to