-
1. Re: JCA JMS service starts consuming messages before the app is fully started
tcunning Aug 18, 2016 3:01 PM (in response to ozkin)In 2.1.0.Final (coming very soon, waiting for permissions to upgrade the release), it's possible to deploy the application with the bindings disabled :
https://issues.jboss.org/browse/SWITCHYARD-2646
You'd need something to enable the bindings once ready, but that shouldn't be that hard.
-
2. Re: JCA JMS service starts consuming messages before the app is fully started
ozkin Aug 18, 2016 3:11 PM (in response to tcunning)Thanks. No any (even ugly) workaround for SY 1.1?
-
3. Re: JCA JMS service starts consuming messages before the app is fully started
tadayosi Aug 18, 2016 9:33 PM (in response to ozkin)Hi,
You may use META-INF/jboss-deployment-structure.xml to control the deployment ordering of applications. It should be possible to make the app that uses JCA/JMS bindings deployed after other necessary apps are deployed by declaring the dependencies.
Class Loading in WildFly - WildFly 8 - Project Documentation Editor
-
4. Re: JCA JMS service starts consuming messages before the app is fully started
ozkin Aug 19, 2016 12:56 PM (in response to tadayosi)I am confused why you use applications in plural. I have only one SwitchYard application. This application contains multiple JCA/JMS service and reference bindings and other bean components. Whole application is just one war file, which consists of my classes and 3rd party dependency jars. Are you saying that with jboss-deployment-structure.xml it is possible to let certain bindings start after other components within the same application? (I didn't find how to do it yet).
-
5. Re: JCA JMS service starts consuming messages before the app is fully started
tadayosi Aug 19, 2016 10:02 PM (in response to ozkin)Sorry, I misunderstood your question. But if it's about a single application, then I don't see why it can be a problem in the first place. IIRC, SwitchYard always activates the services/components/references in the following order: references -> components -> services. So aren't components already up and running before services start? Is it something specific to JCA/JMS binding? Probably there are some mechanisms in your app that specifically prohibits JCA/JMS bindings from working at the start?
-
6. Re: JCA JMS service starts consuming messages before the app is fully started
ozkin Aug 21, 2016 6:21 AM (in response to tadayosi)In my application there are no such mechanisms. Actually I was asking if it is possible to have such mechanisms. My JCA/JMS bindings start working as soon as they are initialized even before application fully started. Yes, components are up and running and they can handle requests. But I have issues with reference bindings. My simple app is JCA/JMS service binding -> Bean component -> JMS reference binding.
If app was down, messages get queued in the queue. When app starts the service starts consuming queued messages. But there is a problem with sending messages out via reference binding. From the logs:
17:08:35,762 INFO [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-2) Route: direct:{urn:my}MyBean/MyReference started and consuming from: Endpoint[direct://{urn:my}:MyBean/MyReference]
<processing of incoming JMS messages already started here>
17:08:43,716 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "MyApp.war"
<Bean processed a message and sends it to reference binding>
17:09:01,327 WARN [org.apache.camel.component.direct.DirectProducer] (default-threads - 7) No consumers available on endpoint: Endpoint[direct://{urn:my}MyBean/MyReference] to process: Exchange[Message: xyz]
Any idea about "No consumers available on endpoint" warnings?
-
7. Re: JCA JMS service starts consuming messages before the app is fully started
tadayosi Aug 21, 2016 8:57 PM (in response to ozkin)Hmm, that's odd. Why does "direct:{urn:my}MyBean/MyReference" starts even though you said your app is using a JMS reference binding? The "direct:" endpoint indicates that you are using Camel URI binding instead of JMS binding for a reference. Can you paste the entire switchyard.xml for MyApp.war here?
-
8. Re: JCA JMS service starts consuming messages before the app is fully started
tadayosi Aug 21, 2016 9:06 PM (in response to ozkin)BTW this warning "No consumers available on endpoint" is well explained here for example:
java - Camel Direct end-point exception - Stack Overflow
It also suggests that you may use the parameter "failIfNoConsumers=false" for the direct endpoint to resolve the problem. It should be worth trying.
-
9. Re: JCA JMS service starts consuming messages before the app is fully started
ozkin Aug 22, 2016 11:17 AM (in response to tadayosi)Having "direct:" in the logs doesn't indicate it is a Camel URI binding. I have tens of different reference bindings (none of them is Camel URI) and SY logs similar log messages for all of them. Maybe this is just the way how those are represented internally in SY...
-
10. Re: JCA JMS service starts consuming messages before the app is fully started
ozkin Aug 22, 2016 11:23 AM (in response to tadayosi)According to the docs "failIfNoConsumers" comes in Apache Camel 2.16.0 which isn't ok for SY1.1. And, anyway, that doesn't solve the problem.. in my case the bean doesn't fail, it just cannot deliver the message.. so better to find out why reference binding isn't accepting the requests..
And in normal circumstances the app works. The problem arises only when it was down, and messages are piled up in the queue, then app starts up and consumes and processes messages quite quickly before all other parts of the app are up and running (here particularly I might be mistaken).