I have servicemix-camel 3.2.2 snapshot in my ServiceMix 3.2.1 instance.
Application Flow:
Bean-SU (Sets message properties) --> Validation-SU(Camel) (after validation
forwards the message)
|---> Routing-SU(Camel) (routes message to App1 if message property matches
condition else sends message to App2)
| |---> Http-Provider-SU1 ---> App1
| ----> Http-Provider-SU2---> App2
I am facing problems in Routing SU which seems to be related to doing
redeployment of same jar file several times.
1) Predicate functions are not working properly :-
The condition in Routing SU is not working sometimes and send the message to
Http-Provider-SU2. I have verified this by repeatedly sending the same
message to ServiceMix. Most of the times it works fine but sometimes
condition fails and message is routed to "otherwise" condition. Most of the
time redeployment of the component solves the problem temporarily and
message is routed correctly.
2) Properties added to Normalized message at Bean-SU is received by
Validation-SU but not able to receive at Routing-SU(some times) :-
Camel does not follow the exact routing logic. We verified this by putting
custom message processor with "System.out.println" statements. Whenever the
problem occurs the S.O.P statements are not printed on the console logs.
This is very weird and we are not able to figure out how to get around this
problem.
Following is the Validate SU, Routing SU code configurations and logs for
normal behavior and error condition:
Please help.
Validate SU:
public void configure() {
from("jbi:endpoint:http://servicemix.in2m.com/operations/changepassword/validateService/validateEndpoint")
.process(new Processor() {
public void process(Exchange ex) throws Exception {
Message in = ex.getIn();
Map<String, Object> headers = in.getHeaders();
Set<String> name = headers.keySet();
System.out.println("header names --" + name);
Iterator<String> name2 = name.iterator();
while(name2.hasNext()) {
String key = name2.next();
System.out.println("headers" +
key+"----"+headers.get(key));
}
}
})
.to("jbi:service:http://servicemix.in2m.com/operations/changepassword/routingService?mep=in-out");
}
Routing-SU:
public void configure() {
from("jbi:service:http://servicemix.in2m.com/operations/changepassword/routingService")
.process(new Processor() {
public void process(Exchange ex) throws Exception {
Message in = ex.getIn();
Map<String, Object> headers = in.getHeaders();
Set<String> name = headers.keySet();
System.out.println("header ----names --" + name);
Iterator<String> name2 = name.iterator();
while(name2.hasNext()) {
String key = name2.next();
System.out.println("headers---------" +
key+"----"+headers.get(key) +"------"+headers.get(key).getClass());
}
System.out.println("Comparison value
"+((String)headers.get("userPrincipals")).equals("smx"));
}
})
.choice()
.when(header("userPrincipals").isEqualTo("smx"))
.to("jbi:service:http://servicemix.in2m.com/operations/changepassword/PortalService?mep=in-out")
.otherwise()
.to("jbi:service:http://servicemix.in2m.com/operations/changepassword/DirectorService?mep=in-out");
}
Normal working:
DEBUG - CamelJbiComponent - Received exchange: status: Active,
role: provider
DEBUG - CamelJbiComponent - Retrieved correlation id:
ID:192.168.2.53-11aba59ec70-4:120
DEBUG - CamelJbiEndpoint - Received exchange: InOut[
id: ID:192.168.2.53-11aba59ec70-273:0
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}validateService
endpoint: validateEndpoint
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
//Logs printed from validate SU
header names --[userPrincipals]
headersuserPrincipals----smx
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.53-11aba59ec70-10:263 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.53-11aba59ec70-10:263 (1598188) to be answered in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aba59ec70-10:263
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}routingService
endpoint: camel192-168-2-53-11aba59ec70-20-129
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
DEBUG - CamelJbiComponent - Received exchange: status: Active,
role: provider
DEBUG - CamelJbiComponent - Retrieved correlation id: null
DEBUG - CamelJbiEndpoint - Received exchange: InOut[
id: ID:192.168.2.53-11aba59ec70-10:263
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}routingService
endpoint: camel192-168-2-53-11aba59ec70-20-129
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
//Logs printed by Routing SU
header ----names --[userPrincipals]
headers---------userPrincipals----smx------class java.lang.String
Comparison value true
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.53-11aba59ec70-10:264 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.53-11aba59ec70-10:264 (193945a) to be answered in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aba59ec70-10:264
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}PortalService
//CORRECT ROUTING
endpoint: PortalEndpoint
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
Error condition:
DEBUG - CamelJbiComponent - Received exchange: status: Active,
role: provider
DEBUG - CamelJbiComponent - Retrieved correlation id:
ID:192.168.2.53-11aba59ec70-4:121
DEBUG - CamelJbiEndpoint - Received exchange: InOut[
id: ID:192.168.2.53-11aba59ec70-276:0
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}validateService
endpoint: validateEndpoint
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
//Logs printed by validate SU
header names --[userPrincipals]
headersuserPrincipals----smx
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.53-11aba59ec70-10:270 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.53-11aba59ec70-10:270 (11bc644) to be answered in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aba59ec70-10:270
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}routingService
endpoint: camel192-168-2-53-11aba59ec70-20-131
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
DEBUG - CamelJbiComponent - Received exchange: status: Active,
role: provider
DEBUG - CamelJbiComponent - Retrieved correlation id: null
DEBUG - CamelJbiEndpoint - Received exchange: InOut[
id: ID:192.168.2.53-11aba59ec70-10:270
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}routingService
endpoint: camel192-168-2-53-11aba59ec70-20-131
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
// NO LOGS PRINTED
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.53-11aba59ec70-10:271 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.53-11aba59ec70-10:271 (5e5158) to be answered in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aba59ec70-10:271
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}DirectorService //
OTHER WISE CONDITION
endpoint: DirectorEndpoint
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
--
View this message in context:
http://www.nabble.com/Strange-behavior-in-Camel-routing-tp18093018p18093018.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.