How make a component to make it work with InOut exchange message ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How make a component to make it work with InOut exchange message ?

Pavan Kumar-9
Hi,

I am new to JBI stuff and been working with servicemix from quite a few days. I am trying to build a POJO into JBI component and the component is something like a FileWriter , but here it writes some other datasource.I have used the FileWriter component as reference and built the component.I was successful in buliding this, but the process is raising an exception like one below:


javax.jbi.messaging.MessagingException: Out not supported at org.servicemix.jbi.messaging.MessageExchangeImpl.setMessage(MessageExchangeImpl.java:275) at org.servicemix.components.util.PojoSupport.answer(PojoSupport.java:225) at com.sirvisetti.esb.DashboardInteractor.dbInsert(DashboardInteractor.java:297) at com.sirvisetti.esb.DashboardInteractor.process(DashboardInteractor.java:102) at org.servicemix.components.util.OutBinding.onMessageExchange(OutBinding.java:51) at
org.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:588 ) at org.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171) at org.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:140) at org.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:119) at org.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:289) at org.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:567) at
org.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:347) at org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:422) at org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:398 ) at org.servicemix.components.file.FilePoller.processFile(FilePoller.java:220) at
 

when passing on the message to some other component.

I guess this is some problem in setting the message as InOut or something like that which should have a two way communication.
Can somebody help me in this or provide the information where i can found something similar to this.

Thanks in advance,
Pavan Kumar
Reply | Threaded
Open this post in threaded view
|

Re: How make a component to make it work with InOut exchange message ?

Guillaume Nodet
Administrator
It seems that you are setting an out message on the exchange.
The exchange has been created by a FilePoller, which create InOnly
exchanges.
Could you please explain why you want to reply to the exchange ? What do you
expect the FilePoller to do ?

Cheers,
Guillaume

Pavan Kumar wrote:

> Hi,
>
> I am new to JBI stuff and been working with servicemix from quite a
> few days. I am trying to build a POJO into JBI component and the
> component is something like a FileWriter , but here it writes some
> other datasource.I have used the FileWriter component as reference and
> built the component.I was successful in buliding this, but the process
> is raising an exception like one below:
>
>
> javax.jbi.messaging.MessagingException: Out not supported at
> org.servicemix.jbi.messaging.MessageExchangeImpl.setMessage(MessageExchangeImpl.java:275)
> at
> org.servicemix.components.util.PojoSupport.answer(PojoSupport.java:225)
> at
> com.sirvisetti.esb.DashboardInteractor.dbInsert(DashboardInteractor.java:297)
> at
> com.sirvisetti.esb.DashboardInteractor.process(DashboardInteractor.java:102)
> at
> org.servicemix.components.util.OutBinding.onMessageExchange(OutBinding.java:51)
> at
> org.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:588
> ) at
> org.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
> at org.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:140)
> at
> org.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:119)
> at org.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:289)
> at
> org.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:567)
> at
> org.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:347)
> at
> org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:422)
> at
> org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:398
> ) at
> org.servicemix.components.file.FilePoller.processFile(FilePoller.java:220)
> at
>  
>
>
> when passing on the message to some other component.
>
> I guess this is some problem in setting the message as InOut or
> something like that which should have a two way communication.
> Can somebody help me in this or provide the information where i can
> found something similar to this.
>
> Thanks in advance,
> Pavan Kumar

Reply | Threaded
Open this post in threaded view
|

Re: How make a component to make it work with InOut exchange message ?

Pavan Kumar-9
Hi,

I had a situation like the one as follows:
 - i need to monitor a directory for xml files  , then  i will pass the  files  to  a  component  which
   does some action like storing data to DB etc and should pass on the message to other
   component  which will carry on a diffrenent set of actions and may stop the process there or
   pass it on to another component.

  Here the first component i used was FilePoller for monitoring the directory and passing on the message to the second component which is similar to a FileWriter component . From there I
tried to do a "answer(excahange,message)" instead of "done(exchange)". Again the message is passed on to third component , there it is throwing the exception that I mentioned earlier.

Can u suggest me a good existing example or any link where I can find the information of
how to handle both InOnly and InOut exchanges.

- Pavan Kumar


On 12/13/05, Guillaume Nodet <[hidden email]> wrote:
It seems that you are setting an out message on the exchange.
The exchange has been created by a FilePoller, which create InOnly
exchanges.
Could you please explain why you want to reply to the exchange ? What do you
expect the FilePoller to do ?

Cheers,
Guillaume

Pavan Kumar wrote:

> Hi,
>
> I am new to JBI stuff and been working with servicemix from quite a
> few days. I am trying to build a POJO into JBI component and the
> component is something like a FileWriter , but here it writes some
> other datasource.I have used the FileWriter component as reference and
> built the component.I was successful in buliding this, but the process
> is raising an exception like one below:
>
>
> javax.jbi.messaging.MessagingException: Out not supported at
> org.servicemix.jbi.messaging.MessageExchangeImpl.setMessage(MessageExchangeImpl.java :275)
> at
> org.servicemix.components.util.PojoSupport.answer(PojoSupport.java:225)
> at
> com.sirvisetti.esb.DashboardInteractor.dbInsert(DashboardInteractor.java:297)
> at
> com.sirvisetti.esb.DashboardInteractor.process (DashboardInteractor.java:102)
> at
> org.servicemix.components.util.OutBinding.onMessageExchange(OutBinding.java:51)
> at
> org.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java :588
> ) at
> org.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
> at org.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:140)
> at
> org.servicemix.jbi.nmr.flow.AbstractFlow.send (AbstractFlow.java:119)
> at org.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:289)
> at
> org.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:567)
> at
> org.servicemix.jbi.messaging.DeliveryChannelImpl.doSend (DeliveryChannelImpl.java:347)
> at
> org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:422)
> at
> org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java :398
> ) at
> org.servicemix.components.file.FilePoller.processFile(FilePoller.java:220)
> at
>
>
>
> when passing on the message to some other component.
>
> I guess this is some problem in setting the message as InOut or
> something like that which should have a two way communication.
> Can somebody help me in this or provide the information where i can
> found something similar to this.
>
> Thanks in advance,
> Pavan Kumar


Reply | Threaded
Open this post in threaded view
|

Re: How make a component to make it work with InOut exchange message ?

Guillaume Nodet
Administrator
You can not use the same message exchange to send the data to the third
component.
A jbi exchange can only involve two components : the consumer and the
producer.
In your case, you have to create a new exchange, and copy the payload in
it, then
send it to the third component.

Cheers,
Guillaume

Pavan Kumar wrote:

> Hi,
>
> I had a situation like the one as follows:
>  - i need to monitor a directory for xml files  , then  i will pass
> the  files  to  a  component  which
>    does some action like storing data to DB etc and should pass on the
> message to other
>    component  which will carry on a diffrenent set of actions and may
> stop the process there or
>    pass it on to another component.
>
>   Here the first component i used was FilePoller for monitoring the
> directory and passing on the message to the second component which is
> similar to a FileWriter component . From there I
> tried to do a "answer(excahange,message)" instead of "done(exchange)".
> Again the message is passed on to third component , there it is
> throwing the exception that I mentioned earlier.
>
> Can u suggest me a good existing example or any link where I can find
> the information of
> how to handle both InOnly and InOut exchanges.
>
> - Pavan Kumar
>
>
> On 12/13/05, *Guillaume Nodet* <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     It seems that you are setting an out message on the exchange.
>     The exchange has been created by a FilePoller, which create InOnly
>     exchanges.
>     Could you please explain why you want to reply to the exchange ?
>     What do you
>     expect the FilePoller to do ?
>
>     Cheers,
>     Guillaume
>
>     Pavan Kumar wrote:
>
>     > Hi,
>     >
>     > I am new to JBI stuff and been working with servicemix from quite a
>     > few days. I am trying to build a POJO into JBI component and the
>     > component is something like a FileWriter , but here it writes some
>     > other datasource.I have used the FileWriter component as
>     reference and
>     > built the component.I was successful in buliding this, but the
>     process
>     > is raising an exception like one below:
>     >
>     >
>     > javax.jbi.messaging.MessagingException: Out not supported at
>     >
>     org.servicemix.jbi.messaging.MessageExchangeImpl.setMessage(MessageExchangeImpl.java
>     :275)
>     > at
>     >
>     org.servicemix.components.util.PojoSupport.answer(PojoSupport.java:225)
>     > at
>     >
>     com.sirvisetti.esb.DashboardInteractor.dbInsert(DashboardInteractor.java:297)
>     > at
>     > com.sirvisetti.esb.DashboardInteractor.process
>     (DashboardInteractor.java:102)
>     > at
>     >
>     org.servicemix.components.util.OutBinding.onMessageExchange(OutBinding.java:51)
>     > at
>     >
>     org.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java
>     :588
>     > ) at
>     >
>     org.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
>     > at
>     org.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:140)
>     > at
>     > org.servicemix.jbi.nmr.flow.AbstractFlow.send
>     (AbstractFlow.java:119)
>     > at org.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:289)
>     > at
>     >
>     org.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:567)
>     > at
>     > org.servicemix.jbi.messaging.DeliveryChannelImpl.doSend
>     (DeliveryChannelImpl.java:347)
>     > at
>     >
>     org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:422)
>     > at
>     >
>     org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java
>     :398
>     > ) at
>     >
>     org.servicemix.components.file.FilePoller.processFile(FilePoller.java:220)
>     > at
>     >
>     >
>     >
>     > when passing on the message to some other component.
>     >
>     > I guess this is some problem in setting the message as InOut or
>     > something like that which should have a two way communication.
>     > Can somebody help me in this or provide the information where i can
>     > found something similar to this.
>     >
>     > Thanks in advance,
>     > Pavan Kumar
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How make a component to make it work with InOut exchange message ?

Pavan Kumar-9
 Guillaume,

  Thanks for the  suggestion.  I  already traced it and did exactly the same what you
   said. Actually I was to pass the same message which is coming in to the second component.      So I cached the  in coming NM and closed the exchange and then after all the operation I   
   created a new  exchange with the cached NM and sync it to the bus.

   So that stratergy worked out for my problem.

   - Pavan Kumar


On 12/14/05, Guillaume Nodet <[hidden email]> wrote:
You can not use the same message exchange to send the data to the third
component.
A jbi exchange can only involve two components : the consumer and the
producer.
In your case, you have to create a new exchange, and copy the payload in
it, then
send it to the third component.

Cheers,
Guillaume

Pavan Kumar wrote:

> Hi,
>
> I had a situation like the one as follows:
>  - i need to monitor a directory for xml files  , then  i will pass
> the  files  to  a  component  which
>    does some action like storing data to DB etc and should pass on the
> message to other
>    component  which will carry on a diffrenent set of actions and may
> stop the process there or
>    pass it on to another component.
>
>   Here the first component i used was FilePoller for monitoring the
> directory and passing on the message to the second component which is
> similar to a FileWriter component . From there I
> tried to do a "answer(excahange,message)" instead of "done(exchange)".
> Again the message is passed on to third component , there it is
> throwing the exception that I mentioned earlier.
>
> Can u suggest me a good existing example or any link where I can find
> the information of
> how to handle both InOnly and InOut exchanges.
>
> - Pavan Kumar
>
>
> On 12/13/05, *Guillaume Nodet* <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     It seems that you are setting an out message on the exchange.
>     The exchange has been created by a FilePoller, which create InOnly
>     exchanges.
>     Could you please explain why you want to reply to the exchange ?
>     What do you
>     expect the FilePoller to do ?
>
>     Cheers,
>     Guillaume
>
>     Pavan Kumar wrote:
>
>     > Hi,
>     >
>     > I am new to JBI stuff and been working with servicemix from quite a
>     > few days. I am trying to build a POJO into JBI component and the
>     > component is something like a FileWriter , but here it writes some
>     > other datasource.I have used the FileWriter component as
>     reference and
>     > built the component.I was successful in buliding this, but the
>     process
>     > is raising an exception like one below:
>     >
>     >
>     > javax.jbi.messaging.MessagingException: Out not supported at

>     >
>     org.servicemix.jbi.messaging.MessageExchangeImpl.setMessage(MessageExchangeImpl.java
>     :275)
>     > at
>     >
>     org.servicemix.components.util.PojoSupport.answer(PojoSupport.java:225)
>     > at
>     >
>     com.sirvisetti.esb.DashboardInteractor.dbInsert(DashboardInteractor.java :297)
>     > at
>     > com.sirvisetti.esb.DashboardInteractor.process
>     (DashboardInteractor.java:102)
>     > at
>     >
>     org.servicemix.components.util.OutBinding.onMessageExchange (OutBinding.java:51)
>     > at
>     >
>     org.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java
>     :588
>     > ) at
>     >
>     org.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
>     > at
>     org.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:140)
>     > at
>     > org.servicemix.jbi.nmr.flow.AbstractFlow.send
>     (AbstractFlow.java:119)
>     > at org.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:289)
>     > at
>     >
>     org.servicemix.jbi.container.JBIContainer.sendExchange (JBIContainer.java:567)
>     > at
>     > org.servicemix.jbi.messaging.DeliveryChannelImpl.doSend
>     (DeliveryChannelImpl.java:347)
>     > at
>     >
>     org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync (DeliveryChannelImpl.java:422)
>     > at
>     >
>     org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java
>     :398
>     > ) at
>     >
>     org.servicemix.components.file.FilePoller.processFile(FilePoller.java:220)

>     > at
>     >
>     >
>     >
>     > when passing on the message to some other component.
>     >
>     > I guess this is some problem in setting the message as InOut or
>     > something like that which should have a two way communication.
>     > Can somebody help me in this or provide the information where i can
>     > found something similar to this.
>     >
>     > Thanks in advance,
>     > Pavan Kumar
>
>