* @param packet
* @throws MessagingException
*/
public void doRouting(final MessageExchangeImpl me) throws MessagingException {
ComponentNameSpace id = me.getRole() == Role.PROVIDER ? me.getDestinationId() : me.getSourceId();
ComponentConnector cc = broker.getRegistry().getComponentConnector(id);
if (cc != null) {
if (me.getMirror().getSyncState() != MessageExchangeImpl.SYNC_STATE_ASYNC) {
throw new IllegalStateException("sendSync can not be used on jca flow with external components");
}
try {
final String componentName = cc.getComponentNameSpace().getName();
JmsTemplate jt = isPersistent(me) ? jmsPersistentTemplate : jmsTemplate;
String destination = "";
if (me.getRole() == Role.PROVIDER){
destination = INBOUND_PREFIX + componentName;
}else {
destination = INBOUND_PREFIX + id.getContainerName();
}
jt.send(destination, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
return session.createObjectMessage(me);
}