You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tim83 <ti...@roots.be> on 2009/06/24 15:36:51 UTC

Problems with JMS messages being dropped by camel when restarting the context

Hi all,

I've stumbled upon an issue and am not sure how to solve it. :confused:
Basicly I've setup some routes using camel 1.6.0 that consume messages and
dispatches them to our services.  Everything works fine except for one
thing.

When I restart my camel context I start to lose messages, and I get the
errors on my consumers.

The route that I use for testing looks like this

<camel:route>
	<camel:from uri="activemq:queue:in.A" />
	<camel:policy ref="PROPAGATION_REQUIRED"/>
	<!-- first assemble the document -->
	<camel:to uri="activemq:queue:service.1?requestTimeout=500000"
pattern="OutIn"/>
	<camel:choice>
		<camel:when>
			<camel:el>${in.headers.errorMessage != null}</camel:el>
			<camel:to uri="activemq:queue:DLQ.in.A?disableReplyTo=true"
pattern="InOnly"/>
			<camel:to uri="activemq:queue:out.A?disableReplyTo=true"
pattern="InOnly"/>
		</camel:when>
		<camel:otherwise>
			<camel:choice>
				<camel:when>
					<camel:el>${in.body["some field"] == "true"}</camel:el>
					<camel:process ref="convertMessageProcessor"/>
					<camel:to uri="activemq:queue:service.B?requestTimeout=500000"
pattern="OutIn"/>
					<camel:choice>
						<camel:when>
							<camel:el>${in.headers.errorMessage} != null</camel:el>
							<camel:process ref="unconvertMessageProcessor"/>
							<camel:to uri="activemq:queue:DLQ.in.A?disableReplyTo=true"
pattern="InOnly"/>
							<!-- send a warning message to ICD that the assembly is
delayed/failed -->
							<camel:to uri="activemq:queue:out.A?disableReplyTo=true"
pattern="InOnly"/>
						</camel:when>
						<camel:otherwise>
							<camel:to uri="activemq:queue:out.A?disableReplyTo=true"
pattern="InOnly"/>
						</camel:otherwise>
					</camel:choice>
				</camel:when>
				<camel:otherwise>
					<camel:to uri="activemq:queue:out.A?disableReplyTo=true"
pattern="InOnly"/>
				</camel:otherwise>
			</camel:choice>
		</camel:otherwise>
	</camel:choice>
</camel:route>

<bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
    	<property name="connectionFactory" ref="jmsFactory"/>
	    <property name="transacted" value="true"/>
	    <property name="concurrentConsumers" value="1"/>
	    <property name="transactedInOut" value="true"/>
	    <property name="transactionManager" ref="jmsTransactionManager"/>
	   	<property name="replyToTempDestinationAffinity" value="producer"/>
	</bean>
	<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
		<property name="connectionFactory" ref="jmsFactory"/>
	</bean>
	
	<!-- camel policy we refer to in our route -->
	<bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
		<constructor-arg>
			<bean
class="org.springframework.transaction.support.TransactionTemplate">
				<property name="transactionManager" ref="jmsTransactionManager"/>
			</bean>
		</constructor-arg>
	</bean>

When I stop the camel context right after the message has arrived in the
service.B consumer, but before it's finished I see the following error in
the console output.

Cannot publish to a deleted Destination:
temp-queue://ID:56P3J-57576-1245848023626-0:0:2; nested exception is
javax.jms.InvalidDestinationException: Cannot publish to a deleted
Destination: temp-queue://ID:56P3J-57576-1245848023626-0:0:2

After which the message is lost?

I also have a simillar issue with the delayer, if I restart my context when
the message got picked up by the delayer the message gets lost?
<camel:route>
	<camel:from uri="activemq:queue:DLQ.in.A" />
	<camel:policy ref="PROPAGATION_REQUIRED"/>
	<camel:bean ref="enricher" method="enrich"/>
	<camel:delayer>
		<camel:simple>header.JMSTimestamp</camel:simple>
		<camel:delay>60000</camel:delay>
	</camel:delayer>
	<camel:to uri="activemq:queue:in.A?disableReplyTo=true" pattern="InOnly"/>
</camel:route>

Does anybody have the same issue? or know how to solve this?

best regards,
Tim
-- 
View this message in context: http://www.nabble.com/Problems-with-JMS-messages-being-dropped-by-camel-when-restarting-the-context-tp24184908p24184908.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problems with JMS messages being dropped by camel when restarting the context

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jun 25, 2009 at 11:42 AM, Tim83<ti...@roots.be> wrote:
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>> Stopping / shutting down is hard. We have debated this before and would in
>> the future look into how we can make it better.
>>
>> Are you having AMQ embedded with Camel that you stop, or is AMQ a remote
>> broker?
>>
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
>
> Active MQ is running remotely.
> Sad to hear that camel isn't able to handle these kinds of problems, as they
> can and will occur...
>
> Is there no way at all to prevent loss of messages caused by shutdown /
> restart?
There is a ticket related to this in JIRA titled - Graceful shutdown
or the likes.
Please use it to post comments / requirements.


>
> Best regards,
> Tim
> --
> View this message in context: http://www.nabble.com/Problems-with-JMS-messages-being-dropped-by-camel-when-restarting-the-context-tp24184908p24200138.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Problems with JMS messages being dropped by camel when restarting the context

Posted by Tim83 <ti...@roots.be>.

Claus Ibsen-2 wrote:
> 
> Hi
> Stopping / shutting down is hard. We have debated this before and would in
> the future look into how we can make it better.
> 
> Are you having AMQ embedded with Camel that you stop, or is AMQ a remote
> broker?
> 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 


Active MQ is running remotely.
Sad to hear that camel isn't able to handle these kinds of problems, as they
can and will occur...

Is there no way at all to prevent loss of messages caused by shutdown /
restart?

Best regards,
Tim
-- 
View this message in context: http://www.nabble.com/Problems-with-JMS-messages-being-dropped-by-camel-when-restarting-the-context-tp24184908p24200138.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problems with JMS messages being dropped by camel when restarting the context

Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Stopping / shutting down is hard. We have debated this before and would in
the future look into how we can make it better.

Are you having AMQ embedded with Camel that you stop, or is AMQ a remote
broker?




On Wed, Jun 24, 2009 at 3:56 PM, Tim83 <ti...@roots.be> wrote:

>
> Here's the complete exception
>
> org.springframework.jms.InvalidDestinationException: Cannot publish to a
> deleted Destination: temp-queue://ID:56P3J-57576-1245848023626-0:0:2;
> nested
> exception is javax.jms.InvalidDestinationException: Cannot publish to a
> deleted Destination: temp-queue://ID:56P3J-57576-1245848023626-0:0:2
>         at
>
> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:277)
>        at
>
> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>        at
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>        at
> org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:539)
>        at *Producer.confirm(ConfirmationProducer.java:26)
>        at *Consumer.onMessage(*Consumer.java:48)
>        at
>
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
>        at
>
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
>        at
>
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
>        at
>
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
>        at
>
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
>        at
>
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
>        at
>
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
>        at
>
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.jms.InvalidDestinationException: Cannot publish to a
> deleted Destination: temp-queue://ID:56P3J-57576-1245848023626-0:0:2
>         at
> org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1597)
>        at
>
> org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:227)
>        at
>
> org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
>        at
> org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:597)
>        at
> org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:574)
>        at
> org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:541)
>        at
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471)
>        ... 12 more
>
>
> Best regards,
> Tim
> --
> View this message in context:
> http://www.nabble.com/Problems-with-JMS-messages-being-dropped-by-camel-when-restarting-the-context-tp24184908p24185284.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Problems with JMS messages being dropped by camel when restarting the context

Posted by Tim83 <ti...@roots.be>.
Here's the complete exception

org.springframework.jms.InvalidDestinationException: Cannot publish to a
deleted Destination: temp-queue://ID:56P3J-57576-1245848023626-0:0:2; nested
exception is javax.jms.InvalidDestinationException: Cannot publish to a
deleted Destination: temp-queue://ID:56P3J-57576-1245848023626-0:0:2
	at
org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:277)
	at
org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
	at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:539)
	at *Producer.confirm(ConfirmationProducer.java:26)
	at *Consumer.onMessage(*Consumer.java:48)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
	at java.lang.Thread.run(Thread.java:619)
Caused by: javax.jms.InvalidDestinationException: Cannot publish to a
deleted Destination: temp-queue://ID:56P3J-57576-1245848023626-0:0:2
	at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1597)
	at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:227)
	at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
	at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:597)
	at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:574)
	at org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:541)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471)
	... 12 more


Best regards,
Tim
-- 
View this message in context: http://www.nabble.com/Problems-with-JMS-messages-being-dropped-by-camel-when-restarting-the-context-tp24184908p24185284.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problems with JMS messages being dropped by camel when restarting the context

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

And just to be sure you had the AMQ configured with transacted=true?
This is required to run really in transacted mode with JMS.


On Wed, Jun 24, 2009 at 3:36 PM, Tim83 <ti...@roots.be> wrote:
>
> Hi all,
>
> I've stumbled upon an issue and am not sure how to solve it. :confused:
> Basicly I've setup some routes using camel 1.6.0 that consume messages and
> dispatches them to our services.  Everything works fine except for one
> thing.
>
> When I restart my camel context I start to lose messages, and I get the
> errors on my consumers.
>
> The route that I use for testing looks like this
>
> <camel:route>
>        <camel:from uri="activemq:queue:in.A" />
>        <camel:policy ref="PROPAGATION_REQUIRED"/>
>        <!-- first assemble the document -->
>        <camel:to uri="activemq:queue:service.1?requestTimeout=500000"
> pattern="OutIn"/>
>        <camel:choice>
>                <camel:when>
>                        <camel:el>${in.headers.errorMessage != null}</camel:el>
>                        <camel:to uri="activemq:queue:DLQ.in.A?disableReplyTo=true"
> pattern="InOnly"/>
>                        <camel:to uri="activemq:queue:out.A?disableReplyTo=true"
> pattern="InOnly"/>
>                </camel:when>
>                <camel:otherwise>
>                        <camel:choice>
>                                <camel:when>
>                                        <camel:el>${in.body["some field"] == "true"}</camel:el>
>                                        <camel:process ref="convertMessageProcessor"/>
>                                        <camel:to uri="activemq:queue:service.B?requestTimeout=500000"
> pattern="OutIn"/>
>                                        <camel:choice>
>                                                <camel:when>
>                                                        <camel:el>${in.headers.errorMessage} != null</camel:el>
>                                                        <camel:process ref="unconvertMessageProcessor"/>
>                                                        <camel:to uri="activemq:queue:DLQ.in.A?disableReplyTo=true"
> pattern="InOnly"/>
>                                                        <!-- send a warning message to ICD that the assembly is
> delayed/failed -->
>                                                        <camel:to uri="activemq:queue:out.A?disableReplyTo=true"
> pattern="InOnly"/>
>                                                </camel:when>
>                                                <camel:otherwise>
>                                                        <camel:to uri="activemq:queue:out.A?disableReplyTo=true"
> pattern="InOnly"/>
>                                                </camel:otherwise>
>                                        </camel:choice>
>                                </camel:when>
>                                <camel:otherwise>
>                                        <camel:to uri="activemq:queue:out.A?disableReplyTo=true"
> pattern="InOnly"/>
>                                </camel:otherwise>
>                        </camel:choice>
>                </camel:otherwise>
>        </camel:choice>
> </camel:route>
>
> <bean id="jmsConfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
>        <property name="connectionFactory" ref="jmsFactory"/>
>            <property name="transacted" value="true"/>
>            <property name="concurrentConsumers" value="1"/>
>            <property name="transactedInOut" value="true"/>
>            <property name="transactionManager" ref="jmsTransactionManager"/>
>                <property name="replyToTempDestinationAffinity" value="producer"/>
>        </bean>
>        <bean id="jmsTransactionManager"
> class="org.springframework.jms.connection.JmsTransactionManager">
>                <property name="connectionFactory" ref="jmsFactory"/>
>        </bean>
>
>        <!-- camel policy we refer to in our route -->
>        <bean id="PROPAGATION_REQUIRED"
> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>                <constructor-arg>
>                        <bean
> class="org.springframework.transaction.support.TransactionTemplate">
>                                <property name="transactionManager" ref="jmsTransactionManager"/>
>                        </bean>
>                </constructor-arg>
>        </bean>
>
> When I stop the camel context right after the message has arrived in the
> service.B consumer, but before it's finished I see the following error in
> the console output.
>
> Cannot publish to a deleted Destination:
> temp-queue://ID:56P3J-57576-1245848023626-0:0:2; nested exception is
> javax.jms.InvalidDestinationException: Cannot publish to a deleted
> Destination: temp-queue://ID:56P3J-57576-1245848023626-0:0:2
>
> After which the message is lost?
>
> I also have a simillar issue with the delayer, if I restart my context when
> the message got picked up by the delayer the message gets lost?
> <camel:route>
>        <camel:from uri="activemq:queue:DLQ.in.A" />
>        <camel:policy ref="PROPAGATION_REQUIRED"/>
>        <camel:bean ref="enricher" method="enrich"/>
>        <camel:delayer>
>                <camel:simple>header.JMSTimestamp</camel:simple>
>                <camel:delay>60000</camel:delay>
>        </camel:delayer>
>        <camel:to uri="activemq:queue:in.A?disableReplyTo=true" pattern="InOnly"/>
> </camel:route>
>
> Does anybody have the same issue? or know how to solve this?
>
> best regards,
> Tim
> --
> View this message in context: http://www.nabble.com/Problems-with-JMS-messages-being-dropped-by-camel-when-restarting-the-context-tp24184908p24184908.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus