I have servicemix-camel 3.2.2 snapshot in my ServiceMix 3.2.1 instance.
Sample flow:
Application 1 --> Http-SU(consumer) --> Bean-SU --> Camel-SU -->
Http-SU(provider) --> Application 2
My Bean-SU gets message from Http-SU, adds properties to Normalized message
and forwards the message to Camel-SU. My property is a collection object
which contains string elements. Following is the code of bean:
public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
try {
NormalizedMessage message = exchange.getMessage("in");
ServiceEndpoint endpoint = exchange.getEndpoint();
message.setProperty("userPrincipals",
message.getSecuritySubject().getPrincipals());
Set<Principal> principals =
message.getSecuritySubject().getPrincipals();
List roles = new ArrayList();
Iterator<Principal> principalIterator = principals.iterator();
while (principalIterator.hasNext()) {
Principal element = (Principal) principalIterator.next();
roles.add(element.getName());
}
ClientFactory factory = (ClientFactory) new
InitialContext().lookup(ClientFactory.DEFAULT_JNDI_NAME);
ServiceMixClient client = factory.createClient();
Destination destination =
client.createDestination("service:http://servicemix.in2m.com/operations/changepassword/validateService");
InOut inOutExchange = destination.createInOutExchange();
NormalizedMessage inMessage = inOutExchange.getInMessage();
inMessage.setProperty("userPrincipals",roles);
inMessage.setContent(message.getContent());
client.sendSync(inOutExchange);
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
} catch (Exception e) {
logger.debug(e);
System.out.println("Exception occured " + e.getMessage());
}
}
I am able to route message to specific service based on the property from
Camel using header("userPrincipals").contains("portal"). But the problem is
that an exception occurs in the bean. My HTTP-SU Consumer never receives a
response and eventually times out.
If I do not set the DONE status then the message is sent twice to Camel-SU.
Following is the error log:
--------------------------------------------------------------------------------------------------------------------------------------------------------
DEBUG - JettyContextManager - Dispatching job:
[EMAIL PROTECTED],io=0,w=true,b=false|false]
DEBUG - JettyContextManager - Dispatching job:
[EMAIL PROTECTED],io=1,w=true,b=false|false]
DEBUG - JAASAuthenticationService - Authenticating 'smx' with 'smx'
DEBUG - HttpComponent - Receiving HTTP request: POST
/changepassword/ HTTP/1.1
appName: Director
Authorization: Basic c214OnNteA==
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:8192
Content-Length: 177
DEBUG - HttpComponent - Created correlation id:
ID:192.168.2.53-11aa5e1886b-4:29
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.53-11aa5e1886b-4:29 in DeliveryChannel{servicemix-http}
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-4:29
status: Active
role: provider
service: {http://servicemix.in2m.com/operations/changepassword}BeanService
endpoint: beanEndpoint
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
DEBUG - BeanComponent - Received exchange: status: Active,
role: provider
DEBUG - BeanComponent - Retrieved correlation id:
ID:192.168.2.53-11aa5e1886b-4:29
INFO - JBIContainer - Activating component for:
[container=ServiceMix,name=ID:192.168.2.53-11aa5e1886b-0:38] with service:
null component: [EMAIL PROTECTED]
INFO - ComponentMBeanImpl - Initializing component:
ID:192.168.2.53-11aa5e1886b-0:38
INFO - ComponentMBeanImpl - Starting component:
ID:192.168.2.53-11aa5e1886b-0:38
DEBUG - HttpComponent - Suspending continuation for
exchange: ID:192.168.2.53-11aa5e1886b-4:29
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.53-11aa5e1886b-118:0 in
DeliveryChannel{ID:192.168.2.53-11aa5e1886b-0:38}
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-118: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>
]
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-11aa5e1886b-118: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>
]
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.53-11aa5e1886b-118:0 (16e05db) to be answered in
DeliveryChannel{ID:192.168.2.53-11aa5e1886b-0:38} from sendSync
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.53-11aa5e1886b-10:80 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-10:80
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}routingService
endpoint: camel192-168-2-53-11aa5e1886b-20-22
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-11aa5e1886b-10:80
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}routingService
endpoint: camel192-168-2-53-11aa5e1886b-20-22
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
]
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.53-11aa5e1886b-10:81 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.53-11aa5e1886b-10:81 (1346394) to be answered in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-10:81
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}PortalService
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>
]
DEBUG - HttpComponent - Received exchange: status: Active,
role: provider
DEBUG - HttpComponent - Retrieved correlation id: null
DEBUG - DefaultHttpParams - Set parameter
http.method.retry-handler =
[EMAIL PROTECTED]
DEBUG - MultiThreadedHttpConnectionManager -
HttpConnectionManager.getConnection: config =
HostConfiguration[host=http://192.168.2.71], timeout = 0
DEBUG - MultiThreadedHttpConnectionManager - Getting free connection,
hostConfig=HostConfiguration[host=http://192.168.2.71]
DEBUG - HttpConnection - Connection is stale, closing...
DEBUG - HttpConnection - Open connection to 192.168.2.71:80
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.53-11aa5e1886b-10:80 (1aa2cc6) to be answered in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - HttpMethodBase - Adding Host request header
DEBUG - EntityEnclosingMethod - Request body sent
DEBUG - HttpMethodBase - Cookie accepted: "$Version=0;
82de8fdbf7056e00d8556195416f75ba=bcd8c3d291c2ba4634164a892caea611; $Path=/"
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.53-11aa5e1886b-10:81 in DeliveryChannel{servicemix-http}
DEBUG - SedaFlow - Called Flow send
DEBUG - HttpMethodBase - Resorting to protocol version
default close connection policy
DEBUG - HttpMethodBase - Should NOT close connection, using
HTTP/1.1
DEBUG - HttpConnection - Releasing connection back to
connection manager.
DEBUG - MultiThreadedHttpConnectionManager - Freeing connection,
hostConfig=HostConfiguration[host=http://192.168.2.71]
DEBUG - IdleConnectionHandler - Adding connection at: 1213980410067
DEBUG - MultiThreadedHttpConnectionManager - Notifying no-one, there are no
waiting threads
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-10:81
status: Active
role: consumer
service:
{http://servicemix.in2m.com/operations/changepassword}PortalService
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>
out: <?xml version="1.0"
encoding="UTF-8"?><Response><status>error</status><message>Service is not
available on portal.</message></Response>
]
DEBUG - DeliveryChannelImpl - Notifying exchange
ID:192.168.2.53-11aa5e1886b-10:81(1346394) in
DeliveryChannel{servicemix-camel} from processInboundSynchronousExchange
DEBUG - DeliveryChannelImpl - Notified:
ID:192.168.2.53-11aa5e1886b-10:81(1346394) in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.53-11aa5e1886b-10:81 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.53-11aa5e1886b-10:80 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-10:80
status: Active
role: consumer
service:
{http://servicemix.in2m.com/operations/changepassword}routingService
endpoint: camel192-168-2-53-11aa5e1886b-20-22
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
out: <?xml version="1.0"
encoding="UTF-8"?><Response><status>error</status><message>Service is not
available on portal.</message></Response>
]
DEBUG - DeliveryChannelImpl - Notifying exchange
ID:192.168.2.53-11aa5e1886b-10:80(1aa2cc6) in
DeliveryChannel{servicemix-camel} from processInboundSynchronousExchange
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-10:81
status: Done
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}PortalService
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>
out: <?xml version="1.0"
encoding="UTF-8"?><Response><status>error</status><message>Service is not
available on portal.</message></Response>
]
DEBUG - HttpComponent - Received exchange: status: Done,
role: provider
DEBUG - HttpComponent - Retrieved correlation id: null
DEBUG - DeliveryChannelImpl - Notified:
ID:192.168.2.53-11aa5e1886b-10:80(1aa2cc6) in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.53-11aa5e1886b-10:80 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.53-11aa5e1886b-118:0 in DeliveryChannel{servicemix-camel}
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-118:0
status: Active
role: consumer
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>
out: <?xml version="1.0"
encoding="UTF-8"?><Response><status>error</status><message>Service is not
available on portal.</message></Response>
]
DEBUG - DeliveryChannelImpl - Notifying exchange
ID:192.168.2.53-11aa5e1886b-118:0(16e05db) in
DeliveryChannel{ID:192.168.2.53-11aa5e1886b-0:38} from
processInboundSynchronousExchange
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:192.168.2.53-11aa5e1886b-10:80
status: Done
role: provider
service:
{http://servicemix.in2m.com/operations/changepassword}routingService
endpoint: camel192-168-2-53-11aa5e1886b-20-22
in: <?xml version="1.0" encoding="UTF-8"?><request
xmlns="http://www.finicity.com">
<updatePassword>
<userName>sandeep37</userName>
<password>mvelopes</password>
</updatePassword>
</request>
out: <?xml version="1.0"
encoding="UTF-8"?><Response><status>error</status><message>Service is not
available on portal.</message></Response>
]
DEBUG - CamelJbiComponent - Received exchange: status: Done,
role: provider
DEBUG - CamelJbiComponent - Retrieved correlation id: null
DEBUG - DeliveryChannelImpl - Notified:
ID:192.168.2.53-11aa5e1886b-118:0(16e05db) in
DeliveryChannel{ID:192.168.2.53-11aa5e1886b-0:38} from sendSync
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.53-11aa5e1886b-4:29 in DeliveryChannel{servicemix-bean}
DEBUG - DeliveryChannelImpl - Exception processing:
ID:192.168.2.53-11aa5e1886b-4:29 in DeliveryChannel{servicemix-bean}
Exception occured illegal exchange status: done
DEBUG - JettyContextManager - Dispatching job:
[EMAIL PROTECTED],pending,expired
DEBUG - HttpComponent - Receiving HTTP request: POST
/changepassword/ HTTP/1.1
appName: Director
Authorization: Basic c214OnNteA==
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:8192
Content-Length: 177
DEBUG - JettyContextManager - Dispatching job:
[EMAIL PROTECTED],io=1,w=true,b=false|false]
--------------------------------------------------------------------------------------------------------------------------------------------------------
Please help.
Thanks,
Sandeep Reddy
--
View this message in context:
http://www.nabble.com/Problem-regarding-Custom-Bean-tp18033529p18033529.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.