You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Matvey <ma...@inbox.ru> on 2009/01/28 12:51:33 UTC
Camel routes to JMS problem: one simple message sent many times
(duplicated)
My confuguration: I want updatesender bean to send one JMS message to Updates
queue every time the method sendUM() invokes. In a real life it work a bit
different...
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<package>org.apache.camel.example.spring</package>
<route>
<from uri="bean:updatesender?methodName=sendUM"/>
<to uri="activemq:queue:Updates?exchangePattern=InOnly" />
</route>
</camelContext>
<bean id="updatesender" class="JMSSender" />
<camel:template id="camelTemplate"/>
------------------------------
My JMSSender class is very simple:
------------------------------
public class JMSSender
{
ArrayList<Properties> um = null;
public void sendMessage(ArrayList<Properties> u)
{
this.um = u;
sendUM();
}
public ArrayList<Properties> sendUM()
{
return um;
}
}
------------------------------
Problems:
1. My problem is that I invoke method sendMessage only once un my app. So
Method sendUM is called only once as well. But using activeMQ monitor I see
that my message was sent every 20-25 seconds and my listener app receives
this message many times, until I stop my application which sent this only
one message.
2. If I stop my listener app and browse my Updates queue than I see only one
message there (although admin app show many messages there), all other
(duplicated) messages are immediately moved to ActiveMQ.DLQ queue.
SO my questions are: how to avoid this behavior and why message resends
every 20-25 seconds automatically, is that configuration problem?
--
View this message in context: http://www.nabble.com/Camel-routes-to-JMS-problem%3A-one-simple-message-sent-many-times-%28duplicated%29-tp21704304s22882p21704304.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel routes to JMS problem: one simple message sent many times
(duplicated)
Posted by Matvey <ma...@inbox.ru>.
Matvey wrote:
>
> My confuguration: I want updatesender bean to send one JMS message to
> Updates queue every time the method sendUM() invokes. In a real life it
> work a bit different...
>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <package>org.apache.camel.example.spring</package>
>
> <route>
> <from uri="bean:updatesender?methodName=sendUM"/>
> <to uri="activemq:queue:Updates?exchangePattern=InOnly" />
> </route>
>
> </camelContext>
>
> <bean id="updatesender" class="JMSSender" />
>
> <camel:template id="camelTemplate"/>
>
> ------------------------------
> My JMSSender class is very simple:
>
> ------------------------------
> public class JMSSender
> {
>
> ArrayList<Properties> um = null;
>
> public void sendMessage(ArrayList<Properties> u)
> {
> this.um = u;
> sendUM();
> }
>
> public ArrayList<Properties> sendUM()
> {
> return um;
> }
>
> }
> ------------------------------
>
> Problems:
> 1. My problem is that I invoke method sendMessage only once un my app. So
> Method sendUM is called only once as well. But using activeMQ monitor I
> see that my message was sent every 20-25 seconds and my listener app
> receives this message many times, until I stop my application which sent
> this only one message.
> 2. If I stop my listener app and browse my Updates queue than I see only
> one message there (although admin app show many messages there), all other
> (duplicated) messages are immediately moved to ActiveMQ.DLQ queue.
>
> SO my questions are: how to avoid this behavior and why message resends
> every 20-25 seconds automatically, is that configuration problem?
>
---------------
Addition
It seems like setting pattern to InOnly via URI
to uri="activemq:queue:Updates?exchangePattern=InOnly" />
does not work at all. I have checked log files - the pattern InOut is always
used. A kind of temporary solution (until Camel 1.5.1 or 2.0 is released) is
described in this topic:
http://www.nabble.com/Asynchronously-sending-POSTed-data-to-the-JMS-queue.-td20917013s22882.html
Any other suggestions or ideas?
P.S. There's no chance to download Camel 1.5.1, all link are dead :^(
--
View this message in context: http://www.nabble.com/Camel-routes-to-JMS-problem%3A-one-simple-message-sent-many-times-%28duplicated%29-tp21704304s22882p21708666.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel routes to JMS problem: one simple message sent many times
(duplicated)
Posted by James Strachan <ja...@gmail.com>.
2009/1/28 Matvey <ma...@inbox.ru>:
>
> My confuguration: I want updatesender bean to send one JMS message to Updates
> queue every time the method sendUM() invokes. In a real life it work a bit
> different...
how about something like this...
http://camel.apache.org/pojo-producing.html
public class Foo {
@EndpointInject(uri="activemq: Updates")
ProducerTemplate producer;
public void sendUM() {
producer.sendBody("<hello>world!</hello>");
}
}
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <package>org.apache.camel.example.spring</package>
>
> <route>
> <from uri="bean:updatesender?methodName=sendUM"/>
> <to uri="activemq:queue:Updates?exchangePattern=InOnly" />
> </route>
this route will poll your bean; am not sure thats what you want
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/