Spring integration message loss scenario
Summary - Message loss during systematic shutdown of application.
I have a application written in spring integration and I am consuming requests from external systems using 'jms:message-driven-channel-adapter'. This is the configuration of the channel adapter -
<jms:message-driven-channel-adapter id="InboundAdapter" destination="InQueue"
connection-factory="connectionFactory"
channel="responseChannel"
error-channel="errorChannel"
acknowledge="transacted"
receive-timeout="50000"
auto-startup="true"/>
my response channel looks like this -
<int:chain id="processorChain" input-channel="responseChannel">
<int:service-activator method="doProcess" ref="inputProcessor" />
<int:router id="inputRouter" method="route">
<int:mapping value="REQUIRED" channel="builderChannel"/>
<int:mapping value="NOT_REQUIRED" channel="TerminateChannel"/>
<bean id="Router" class="xxx.xxx.Router">
</bean>
</int:router>
</int:chain>
Now when i perform 'kill -9 pid', then I see that the message is rolled back to the queue and it is all good. But when I am performing 'kill pid', than the message is lost somewhere. I have enabled teh jms logs and I can see that JMS listener is waiting for the message in transit to complete before closing the JMS consumer but still I don't the message rolling back to my queue. This is the logs snippet that I see in my logs
trace: 15.11.18 15:42:46.619 [Thread-10] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Waiting for shutdown of message listener invokers
trace: 15.11.18 15:42:46.619 [Thread-10] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Still waiting for shutdown of 1 message listener invokers (iteration 0)
After this logs, it is calling the service activators which are defined in the response channel.
Can someone please shed some light on above behavior, I was expecting that when we issue kill command than all messages which are in transit should be rolled back to the queue, instead of this, it is trying to call the activators defined with in channel and after calling last component which is router, it just finishes.
Any help on this topic will be really helpful!!
After some more debugging and banging my head with the system I found the exact scenario where it is happening. Let me put it thru to see if it makes sense. When a systematic shutdown is triggered, JMS is waiting for the messages in transit to finish before stopping the application, till this point everything is good. Currently this chain is being executed -
<int:chain input-channel="inputchain">
<int:transformer id="xxx" method="transform">
<bean class="xxx" />
</int:transformer>
<int:service-activator id="xxx" method="doProcess">
<bean class="xx">
<constructor-arg ref="xxx"/>
</bean>
</int:service-activator>
<int:service-activator id="xxx" ref="rulesProcessor" method="doProcess"/>
<int:service-activator id="xxx" ref="xxx" method="doProcess"/>
<!-- Existing Flow Continues -->
<int:router id="xxxRequiredRouter" method="xxxRequired">
<int:mapping value="Required" channel="firstChannel"/>
<int:mapping value="NotRequired" channel="secondChannel"/>
<bean id="xxxRouter" class="xxx.Router" />
</bean>
</int:router>
</int:chain>
<int:chain input-channel="secondChannel">
some logic
</int:chain>
So the thread finishes this chain and exits gracefully. It doesn't call my next chain 'secondChannel'. My transaction boundary doesn't finish on this chain 'inputchain', it finishes at the end of secondChannel. So I have not comnmitted this transction to database as transaction boundary is at the end of next chain, so this is not available in DB and application is thinking that chain execution is finished so it is complete, so it is not rolled back to teh queue as well. So in teh end I don't have this message in my database and it is not in queue.
So is this the case that only the chain which is being executed when shutdown was triggered will finish and it will not delegate processing to subsequent chains?
spring spring-integration message loss
add a comment |
Summary - Message loss during systematic shutdown of application.
I have a application written in spring integration and I am consuming requests from external systems using 'jms:message-driven-channel-adapter'. This is the configuration of the channel adapter -
<jms:message-driven-channel-adapter id="InboundAdapter" destination="InQueue"
connection-factory="connectionFactory"
channel="responseChannel"
error-channel="errorChannel"
acknowledge="transacted"
receive-timeout="50000"
auto-startup="true"/>
my response channel looks like this -
<int:chain id="processorChain" input-channel="responseChannel">
<int:service-activator method="doProcess" ref="inputProcessor" />
<int:router id="inputRouter" method="route">
<int:mapping value="REQUIRED" channel="builderChannel"/>
<int:mapping value="NOT_REQUIRED" channel="TerminateChannel"/>
<bean id="Router" class="xxx.xxx.Router">
</bean>
</int:router>
</int:chain>
Now when i perform 'kill -9 pid', then I see that the message is rolled back to the queue and it is all good. But when I am performing 'kill pid', than the message is lost somewhere. I have enabled teh jms logs and I can see that JMS listener is waiting for the message in transit to complete before closing the JMS consumer but still I don't the message rolling back to my queue. This is the logs snippet that I see in my logs
trace: 15.11.18 15:42:46.619 [Thread-10] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Waiting for shutdown of message listener invokers
trace: 15.11.18 15:42:46.619 [Thread-10] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Still waiting for shutdown of 1 message listener invokers (iteration 0)
After this logs, it is calling the service activators which are defined in the response channel.
Can someone please shed some light on above behavior, I was expecting that when we issue kill command than all messages which are in transit should be rolled back to the queue, instead of this, it is trying to call the activators defined with in channel and after calling last component which is router, it just finishes.
Any help on this topic will be really helpful!!
After some more debugging and banging my head with the system I found the exact scenario where it is happening. Let me put it thru to see if it makes sense. When a systematic shutdown is triggered, JMS is waiting for the messages in transit to finish before stopping the application, till this point everything is good. Currently this chain is being executed -
<int:chain input-channel="inputchain">
<int:transformer id="xxx" method="transform">
<bean class="xxx" />
</int:transformer>
<int:service-activator id="xxx" method="doProcess">
<bean class="xx">
<constructor-arg ref="xxx"/>
</bean>
</int:service-activator>
<int:service-activator id="xxx" ref="rulesProcessor" method="doProcess"/>
<int:service-activator id="xxx" ref="xxx" method="doProcess"/>
<!-- Existing Flow Continues -->
<int:router id="xxxRequiredRouter" method="xxxRequired">
<int:mapping value="Required" channel="firstChannel"/>
<int:mapping value="NotRequired" channel="secondChannel"/>
<bean id="xxxRouter" class="xxx.Router" />
</bean>
</int:router>
</int:chain>
<int:chain input-channel="secondChannel">
some logic
</int:chain>
So the thread finishes this chain and exits gracefully. It doesn't call my next chain 'secondChannel'. My transaction boundary doesn't finish on this chain 'inputchain', it finishes at the end of secondChannel. So I have not comnmitted this transction to database as transaction boundary is at the end of next chain, so this is not available in DB and application is thinking that chain execution is finished so it is complete, so it is not rolled back to teh queue as well. So in teh end I don't have this message in my database and it is not in queue.
So is this the case that only the chain which is being executed when shutdown was triggered will finish and it will not delegate processing to subsequent chains?
spring spring-integration message loss
Why do you say a "message loss", if you explain in the end that everything goes well until the router? I would say this is fully normal behavior when we call stop, but let in-flight tasks to be finished.
– Artem Bilan
Nov 15 '18 at 16:48
Hi Artem, I am calling it message loss because after calling the router, it should have gone to the next chain (builderChannel). But after router execution there is nothing else happening. Since execution didn't finished so my transaction is not committed to database and since the message didn't went back to queue so I can not process it when server comes back again. So effectively I have lost the message and I will have to ask the source systems to play it again manually which is not a acceptable solution.
– Vaibs
Nov 16 '18 at 9:27
If your all process is in the same thread, then I would suggest to use aJmsTransactionManager
for that<jms:message-driven-channel-adapter>
. Also since you mentioned data based it might even better to wrap both transaction managers into theChainedTransactionManager
. See here for more info: javaworld.com/article/2077963/open-source-tools/…
– Artem Bilan
Nov 16 '18 at 17:17
add a comment |
Summary - Message loss during systematic shutdown of application.
I have a application written in spring integration and I am consuming requests from external systems using 'jms:message-driven-channel-adapter'. This is the configuration of the channel adapter -
<jms:message-driven-channel-adapter id="InboundAdapter" destination="InQueue"
connection-factory="connectionFactory"
channel="responseChannel"
error-channel="errorChannel"
acknowledge="transacted"
receive-timeout="50000"
auto-startup="true"/>
my response channel looks like this -
<int:chain id="processorChain" input-channel="responseChannel">
<int:service-activator method="doProcess" ref="inputProcessor" />
<int:router id="inputRouter" method="route">
<int:mapping value="REQUIRED" channel="builderChannel"/>
<int:mapping value="NOT_REQUIRED" channel="TerminateChannel"/>
<bean id="Router" class="xxx.xxx.Router">
</bean>
</int:router>
</int:chain>
Now when i perform 'kill -9 pid', then I see that the message is rolled back to the queue and it is all good. But when I am performing 'kill pid', than the message is lost somewhere. I have enabled teh jms logs and I can see that JMS listener is waiting for the message in transit to complete before closing the JMS consumer but still I don't the message rolling back to my queue. This is the logs snippet that I see in my logs
trace: 15.11.18 15:42:46.619 [Thread-10] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Waiting for shutdown of message listener invokers
trace: 15.11.18 15:42:46.619 [Thread-10] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Still waiting for shutdown of 1 message listener invokers (iteration 0)
After this logs, it is calling the service activators which are defined in the response channel.
Can someone please shed some light on above behavior, I was expecting that when we issue kill command than all messages which are in transit should be rolled back to the queue, instead of this, it is trying to call the activators defined with in channel and after calling last component which is router, it just finishes.
Any help on this topic will be really helpful!!
After some more debugging and banging my head with the system I found the exact scenario where it is happening. Let me put it thru to see if it makes sense. When a systematic shutdown is triggered, JMS is waiting for the messages in transit to finish before stopping the application, till this point everything is good. Currently this chain is being executed -
<int:chain input-channel="inputchain">
<int:transformer id="xxx" method="transform">
<bean class="xxx" />
</int:transformer>
<int:service-activator id="xxx" method="doProcess">
<bean class="xx">
<constructor-arg ref="xxx"/>
</bean>
</int:service-activator>
<int:service-activator id="xxx" ref="rulesProcessor" method="doProcess"/>
<int:service-activator id="xxx" ref="xxx" method="doProcess"/>
<!-- Existing Flow Continues -->
<int:router id="xxxRequiredRouter" method="xxxRequired">
<int:mapping value="Required" channel="firstChannel"/>
<int:mapping value="NotRequired" channel="secondChannel"/>
<bean id="xxxRouter" class="xxx.Router" />
</bean>
</int:router>
</int:chain>
<int:chain input-channel="secondChannel">
some logic
</int:chain>
So the thread finishes this chain and exits gracefully. It doesn't call my next chain 'secondChannel'. My transaction boundary doesn't finish on this chain 'inputchain', it finishes at the end of secondChannel. So I have not comnmitted this transction to database as transaction boundary is at the end of next chain, so this is not available in DB and application is thinking that chain execution is finished so it is complete, so it is not rolled back to teh queue as well. So in teh end I don't have this message in my database and it is not in queue.
So is this the case that only the chain which is being executed when shutdown was triggered will finish and it will not delegate processing to subsequent chains?
spring spring-integration message loss
Summary - Message loss during systematic shutdown of application.
I have a application written in spring integration and I am consuming requests from external systems using 'jms:message-driven-channel-adapter'. This is the configuration of the channel adapter -
<jms:message-driven-channel-adapter id="InboundAdapter" destination="InQueue"
connection-factory="connectionFactory"
channel="responseChannel"
error-channel="errorChannel"
acknowledge="transacted"
receive-timeout="50000"
auto-startup="true"/>
my response channel looks like this -
<int:chain id="processorChain" input-channel="responseChannel">
<int:service-activator method="doProcess" ref="inputProcessor" />
<int:router id="inputRouter" method="route">
<int:mapping value="REQUIRED" channel="builderChannel"/>
<int:mapping value="NOT_REQUIRED" channel="TerminateChannel"/>
<bean id="Router" class="xxx.xxx.Router">
</bean>
</int:router>
</int:chain>
Now when i perform 'kill -9 pid', then I see that the message is rolled back to the queue and it is all good. But when I am performing 'kill pid', than the message is lost somewhere. I have enabled teh jms logs and I can see that JMS listener is waiting for the message in transit to complete before closing the JMS consumer but still I don't the message rolling back to my queue. This is the logs snippet that I see in my logs
trace: 15.11.18 15:42:46.619 [Thread-10] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Waiting for shutdown of message listener invokers
trace: 15.11.18 15:42:46.619 [Thread-10] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Still waiting for shutdown of 1 message listener invokers (iteration 0)
After this logs, it is calling the service activators which are defined in the response channel.
Can someone please shed some light on above behavior, I was expecting that when we issue kill command than all messages which are in transit should be rolled back to the queue, instead of this, it is trying to call the activators defined with in channel and after calling last component which is router, it just finishes.
Any help on this topic will be really helpful!!
After some more debugging and banging my head with the system I found the exact scenario where it is happening. Let me put it thru to see if it makes sense. When a systematic shutdown is triggered, JMS is waiting for the messages in transit to finish before stopping the application, till this point everything is good. Currently this chain is being executed -
<int:chain input-channel="inputchain">
<int:transformer id="xxx" method="transform">
<bean class="xxx" />
</int:transformer>
<int:service-activator id="xxx" method="doProcess">
<bean class="xx">
<constructor-arg ref="xxx"/>
</bean>
</int:service-activator>
<int:service-activator id="xxx" ref="rulesProcessor" method="doProcess"/>
<int:service-activator id="xxx" ref="xxx" method="doProcess"/>
<!-- Existing Flow Continues -->
<int:router id="xxxRequiredRouter" method="xxxRequired">
<int:mapping value="Required" channel="firstChannel"/>
<int:mapping value="NotRequired" channel="secondChannel"/>
<bean id="xxxRouter" class="xxx.Router" />
</bean>
</int:router>
</int:chain>
<int:chain input-channel="secondChannel">
some logic
</int:chain>
So the thread finishes this chain and exits gracefully. It doesn't call my next chain 'secondChannel'. My transaction boundary doesn't finish on this chain 'inputchain', it finishes at the end of secondChannel. So I have not comnmitted this transction to database as transaction boundary is at the end of next chain, so this is not available in DB and application is thinking that chain execution is finished so it is complete, so it is not rolled back to teh queue as well. So in teh end I don't have this message in my database and it is not in queue.
So is this the case that only the chain which is being executed when shutdown was triggered will finish and it will not delegate processing to subsequent chains?
spring spring-integration message loss
spring spring-integration message loss
edited Nov 21 '18 at 16:35
Vaibs
asked Nov 15 '18 at 16:30
VaibsVaibs
164
164
Why do you say a "message loss", if you explain in the end that everything goes well until the router? I would say this is fully normal behavior when we call stop, but let in-flight tasks to be finished.
– Artem Bilan
Nov 15 '18 at 16:48
Hi Artem, I am calling it message loss because after calling the router, it should have gone to the next chain (builderChannel). But after router execution there is nothing else happening. Since execution didn't finished so my transaction is not committed to database and since the message didn't went back to queue so I can not process it when server comes back again. So effectively I have lost the message and I will have to ask the source systems to play it again manually which is not a acceptable solution.
– Vaibs
Nov 16 '18 at 9:27
If your all process is in the same thread, then I would suggest to use aJmsTransactionManager
for that<jms:message-driven-channel-adapter>
. Also since you mentioned data based it might even better to wrap both transaction managers into theChainedTransactionManager
. See here for more info: javaworld.com/article/2077963/open-source-tools/…
– Artem Bilan
Nov 16 '18 at 17:17
add a comment |
Why do you say a "message loss", if you explain in the end that everything goes well until the router? I would say this is fully normal behavior when we call stop, but let in-flight tasks to be finished.
– Artem Bilan
Nov 15 '18 at 16:48
Hi Artem, I am calling it message loss because after calling the router, it should have gone to the next chain (builderChannel). But after router execution there is nothing else happening. Since execution didn't finished so my transaction is not committed to database and since the message didn't went back to queue so I can not process it when server comes back again. So effectively I have lost the message and I will have to ask the source systems to play it again manually which is not a acceptable solution.
– Vaibs
Nov 16 '18 at 9:27
If your all process is in the same thread, then I would suggest to use aJmsTransactionManager
for that<jms:message-driven-channel-adapter>
. Also since you mentioned data based it might even better to wrap both transaction managers into theChainedTransactionManager
. See here for more info: javaworld.com/article/2077963/open-source-tools/…
– Artem Bilan
Nov 16 '18 at 17:17
Why do you say a "message loss", if you explain in the end that everything goes well until the router? I would say this is fully normal behavior when we call stop, but let in-flight tasks to be finished.
– Artem Bilan
Nov 15 '18 at 16:48
Why do you say a "message loss", if you explain in the end that everything goes well until the router? I would say this is fully normal behavior when we call stop, but let in-flight tasks to be finished.
– Artem Bilan
Nov 15 '18 at 16:48
Hi Artem, I am calling it message loss because after calling the router, it should have gone to the next chain (builderChannel). But after router execution there is nothing else happening. Since execution didn't finished so my transaction is not committed to database and since the message didn't went back to queue so I can not process it when server comes back again. So effectively I have lost the message and I will have to ask the source systems to play it again manually which is not a acceptable solution.
– Vaibs
Nov 16 '18 at 9:27
Hi Artem, I am calling it message loss because after calling the router, it should have gone to the next chain (builderChannel). But after router execution there is nothing else happening. Since execution didn't finished so my transaction is not committed to database and since the message didn't went back to queue so I can not process it when server comes back again. So effectively I have lost the message and I will have to ask the source systems to play it again manually which is not a acceptable solution.
– Vaibs
Nov 16 '18 at 9:27
If your all process is in the same thread, then I would suggest to use a
JmsTransactionManager
for that <jms:message-driven-channel-adapter>
. Also since you mentioned data based it might even better to wrap both transaction managers into the ChainedTransactionManager
. See here for more info: javaworld.com/article/2077963/open-source-tools/…– Artem Bilan
Nov 16 '18 at 17:17
If your all process is in the same thread, then I would suggest to use a
JmsTransactionManager
for that <jms:message-driven-channel-adapter>
. Also since you mentioned data based it might even better to wrap both transaction managers into the ChainedTransactionManager
. See here for more info: javaworld.com/article/2077963/open-source-tools/…– Artem Bilan
Nov 16 '18 at 17:17
add a comment |
1 Answer
1
active
oldest
votes
A SIGTERM kill will wait for the thread to complete its work.
Eventually the container will interrupt it, but that will only help if it's doing something that's interruptible.
Yes, That was teh expectation that it should either finish the task whicc is in progress and if it is not committed than the message should be rolled back to the queue. But I don't see any of this is happening, my transaction is not complete so it is not committed and the message didn't went back to the queue. either
– Vaibs
Nov 16 '18 at 9:31
That's not possible unless the thread is stuck in some uninterruptible code and never returns to the container and the JVM never shuts down.
– Gary Russell
Nov 16 '18 at 15:04
Thanks for reply Gary. I know this is strange and it should have worked the way we are expecting but somehow I am not getting the desired results. I was thinking if I should use client acknowledgement rather than using transacted. Do you think that will help me as the control will be in client code rather than relying on framework. Do you think it would be a good approach?
– Vaibs
Nov 20 '18 at 9:10
It should not be necessary; if you can post a small project somewhere, that reproduces the behavior, I will take a look at it.
– Gary Russell
Nov 20 '18 at 13:58
After some more debugging and banging my head with the system I found the exact scenario where it is happening. I have updated the actual issue with the findings.
– Vaibs
Nov 21 '18 at 16:36
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323901%2fspring-integration-message-loss-scenario%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A SIGTERM kill will wait for the thread to complete its work.
Eventually the container will interrupt it, but that will only help if it's doing something that's interruptible.
Yes, That was teh expectation that it should either finish the task whicc is in progress and if it is not committed than the message should be rolled back to the queue. But I don't see any of this is happening, my transaction is not complete so it is not committed and the message didn't went back to the queue. either
– Vaibs
Nov 16 '18 at 9:31
That's not possible unless the thread is stuck in some uninterruptible code and never returns to the container and the JVM never shuts down.
– Gary Russell
Nov 16 '18 at 15:04
Thanks for reply Gary. I know this is strange and it should have worked the way we are expecting but somehow I am not getting the desired results. I was thinking if I should use client acknowledgement rather than using transacted. Do you think that will help me as the control will be in client code rather than relying on framework. Do you think it would be a good approach?
– Vaibs
Nov 20 '18 at 9:10
It should not be necessary; if you can post a small project somewhere, that reproduces the behavior, I will take a look at it.
– Gary Russell
Nov 20 '18 at 13:58
After some more debugging and banging my head with the system I found the exact scenario where it is happening. I have updated the actual issue with the findings.
– Vaibs
Nov 21 '18 at 16:36
|
show 3 more comments
A SIGTERM kill will wait for the thread to complete its work.
Eventually the container will interrupt it, but that will only help if it's doing something that's interruptible.
Yes, That was teh expectation that it should either finish the task whicc is in progress and if it is not committed than the message should be rolled back to the queue. But I don't see any of this is happening, my transaction is not complete so it is not committed and the message didn't went back to the queue. either
– Vaibs
Nov 16 '18 at 9:31
That's not possible unless the thread is stuck in some uninterruptible code and never returns to the container and the JVM never shuts down.
– Gary Russell
Nov 16 '18 at 15:04
Thanks for reply Gary. I know this is strange and it should have worked the way we are expecting but somehow I am not getting the desired results. I was thinking if I should use client acknowledgement rather than using transacted. Do you think that will help me as the control will be in client code rather than relying on framework. Do you think it would be a good approach?
– Vaibs
Nov 20 '18 at 9:10
It should not be necessary; if you can post a small project somewhere, that reproduces the behavior, I will take a look at it.
– Gary Russell
Nov 20 '18 at 13:58
After some more debugging and banging my head with the system I found the exact scenario where it is happening. I have updated the actual issue with the findings.
– Vaibs
Nov 21 '18 at 16:36
|
show 3 more comments
A SIGTERM kill will wait for the thread to complete its work.
Eventually the container will interrupt it, but that will only help if it's doing something that's interruptible.
A SIGTERM kill will wait for the thread to complete its work.
Eventually the container will interrupt it, but that will only help if it's doing something that's interruptible.
answered Nov 15 '18 at 17:03
Gary RussellGary Russell
84.1k84976
84.1k84976
Yes, That was teh expectation that it should either finish the task whicc is in progress and if it is not committed than the message should be rolled back to the queue. But I don't see any of this is happening, my transaction is not complete so it is not committed and the message didn't went back to the queue. either
– Vaibs
Nov 16 '18 at 9:31
That's not possible unless the thread is stuck in some uninterruptible code and never returns to the container and the JVM never shuts down.
– Gary Russell
Nov 16 '18 at 15:04
Thanks for reply Gary. I know this is strange and it should have worked the way we are expecting but somehow I am not getting the desired results. I was thinking if I should use client acknowledgement rather than using transacted. Do you think that will help me as the control will be in client code rather than relying on framework. Do you think it would be a good approach?
– Vaibs
Nov 20 '18 at 9:10
It should not be necessary; if you can post a small project somewhere, that reproduces the behavior, I will take a look at it.
– Gary Russell
Nov 20 '18 at 13:58
After some more debugging and banging my head with the system I found the exact scenario where it is happening. I have updated the actual issue with the findings.
– Vaibs
Nov 21 '18 at 16:36
|
show 3 more comments
Yes, That was teh expectation that it should either finish the task whicc is in progress and if it is not committed than the message should be rolled back to the queue. But I don't see any of this is happening, my transaction is not complete so it is not committed and the message didn't went back to the queue. either
– Vaibs
Nov 16 '18 at 9:31
That's not possible unless the thread is stuck in some uninterruptible code and never returns to the container and the JVM never shuts down.
– Gary Russell
Nov 16 '18 at 15:04
Thanks for reply Gary. I know this is strange and it should have worked the way we are expecting but somehow I am not getting the desired results. I was thinking if I should use client acknowledgement rather than using transacted. Do you think that will help me as the control will be in client code rather than relying on framework. Do you think it would be a good approach?
– Vaibs
Nov 20 '18 at 9:10
It should not be necessary; if you can post a small project somewhere, that reproduces the behavior, I will take a look at it.
– Gary Russell
Nov 20 '18 at 13:58
After some more debugging and banging my head with the system I found the exact scenario where it is happening. I have updated the actual issue with the findings.
– Vaibs
Nov 21 '18 at 16:36
Yes, That was teh expectation that it should either finish the task whicc is in progress and if it is not committed than the message should be rolled back to the queue. But I don't see any of this is happening, my transaction is not complete so it is not committed and the message didn't went back to the queue. either
– Vaibs
Nov 16 '18 at 9:31
Yes, That was teh expectation that it should either finish the task whicc is in progress and if it is not committed than the message should be rolled back to the queue. But I don't see any of this is happening, my transaction is not complete so it is not committed and the message didn't went back to the queue. either
– Vaibs
Nov 16 '18 at 9:31
That's not possible unless the thread is stuck in some uninterruptible code and never returns to the container and the JVM never shuts down.
– Gary Russell
Nov 16 '18 at 15:04
That's not possible unless the thread is stuck in some uninterruptible code and never returns to the container and the JVM never shuts down.
– Gary Russell
Nov 16 '18 at 15:04
Thanks for reply Gary. I know this is strange and it should have worked the way we are expecting but somehow I am not getting the desired results. I was thinking if I should use client acknowledgement rather than using transacted. Do you think that will help me as the control will be in client code rather than relying on framework. Do you think it would be a good approach?
– Vaibs
Nov 20 '18 at 9:10
Thanks for reply Gary. I know this is strange and it should have worked the way we are expecting but somehow I am not getting the desired results. I was thinking if I should use client acknowledgement rather than using transacted. Do you think that will help me as the control will be in client code rather than relying on framework. Do you think it would be a good approach?
– Vaibs
Nov 20 '18 at 9:10
It should not be necessary; if you can post a small project somewhere, that reproduces the behavior, I will take a look at it.
– Gary Russell
Nov 20 '18 at 13:58
It should not be necessary; if you can post a small project somewhere, that reproduces the behavior, I will take a look at it.
– Gary Russell
Nov 20 '18 at 13:58
After some more debugging and banging my head with the system I found the exact scenario where it is happening. I have updated the actual issue with the findings.
– Vaibs
Nov 21 '18 at 16:36
After some more debugging and banging my head with the system I found the exact scenario where it is happening. I have updated the actual issue with the findings.
– Vaibs
Nov 21 '18 at 16:36
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323901%2fspring-integration-message-loss-scenario%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why do you say a "message loss", if you explain in the end that everything goes well until the router? I would say this is fully normal behavior when we call stop, but let in-flight tasks to be finished.
– Artem Bilan
Nov 15 '18 at 16:48
Hi Artem, I am calling it message loss because after calling the router, it should have gone to the next chain (builderChannel). But after router execution there is nothing else happening. Since execution didn't finished so my transaction is not committed to database and since the message didn't went back to queue so I can not process it when server comes back again. So effectively I have lost the message and I will have to ask the source systems to play it again manually which is not a acceptable solution.
– Vaibs
Nov 16 '18 at 9:27
If your all process is in the same thread, then I would suggest to use a
JmsTransactionManager
for that<jms:message-driven-channel-adapter>
. Also since you mentioned data based it might even better to wrap both transaction managers into theChainedTransactionManager
. See here for more info: javaworld.com/article/2077963/open-source-tools/…– Artem Bilan
Nov 16 '18 at 17:17