The other way would be to have getter / setter on your pojo
for the destination service, and call
exchange.setService(service)
or inject on your bean an EndpointResolver and use it when calling
client.createInOutExchange(resolver)
for example.
On 10/16/06, moraleslos <[EMAIL PROTECTED]> wrote:
Ok, so would I have access to the component context using the Client API w/o
extending from POJOSupport? My current implementation is "Being even more
POJO", i.e. only implements MessageExchangeListener...
If I can't get away with this w/o extending from POJOSupport, then I guess
I'll have to go that route...
Thanks in advance.
-los
gnodet wrote:
>
> This is because you use a new client.
> In your case, you should create a ServiceMixClientFacade
> on top of the ComponentContext from your component.
>
> ServiceMixClient client = new ServiceMixClientFacade(getContext());
>
> instead of injecting a new client.
>
> On 10/16/06, moraleslos <[EMAIL PROTECTED]> wrote:
>>
>> I've debugged a bit more and found out that the endpoint of the exchange
>> is
>> coming back NULL. Now, since I've defined the "destinationService" for
>> my
>> archiveExtractor component, how come its not pulling this destination
>> information when I create the in/only exchange, e.g.
>> client.createInOnlyExchange()? I don't want to set the destination with
>> the
>> endpoint programmatically... I want the JBI container to find it via
>> declaratively. How do I accomplish this? Thanks in advance!
>>
>> -los
>>
>>
>>
>> moraleslos wrote:
>> >
>> > Thanks for the reply. Seems like your suggestion worked. However, I'm
>> > running into this issue with the Client API:
>> > "javax.jbi.messaging.MessagingException: Could not find route for
>> > exchange". This occurs when I call 'client.sendSync(inOnlyExchange)'.
>> > Not sure why it could not find my destination endpoint since I defined
>> it
>> > in my servicemix.xml. Below is the config:
>> >
>> > ***************************************
>> > <sm:activationSpec
>> > componentName="customFTPPoller"
>> > service="foo:customFTPPoller"
>> >
>> destinationService="foo:archiveExtractor">
>> > <sm:component>
>> > <bean
>> class="com.test.servicemix.CustomFTPPoller">
>> > <property name="clientPool"
>> ref="ftpClientPool"/>
>> > <property
>> name="workManager" ref="workManager"/>
>> > <property name="period"
>> value="100"/>
>> > <property name="path"
>> value="/home/ftp/test"/>
>> > <property
>> name="deleteFile" value="false"/>
>> > <property
>> name="marshaler">
>> > <bean
>> > class="org.apache.servicemix.components.util.BinaryFileMarshaler"/>
>> > </property>
>> > </bean>
>> > </sm:component>
>> > </sm:activationSpec>
>> >
>> >
>> > <sm:activationSpec
>> > componentName="archiveExtractor"
>> > service="foo:archiveExtractor"
>> > destinationService="foo:archiveEndpoint">
>> > <sm:component>
>> > <bean
>> class="com.test.servicemix.ArchiveExtractor">
>> > <property
>> name="zipDirectory" value="/zip"/>
>> > <property name="client"
>> ref="serviceMixClient"/>
>> > <property
>> name="marshaler">
>> > <bean
>> > class="org.apache.servicemix.components.util.BinaryFileMarshaler"/>
>> > </property>
>> > </bean>
>> > </sm:component>
>> > </sm:activationSpec>
>> >
>> >
>> > <sm:activationSpec
>> componentName="archiveEndpoint"
>> > service="foo:archiveEndpoint">
>> > <sm:component>
>> > <bean
>> class="org.apache.servicemix.components.file.FileWriter">
>> > <property
>> name="directory" value="/extract"/>
>> > <property
>> name="marshaler">
>> > <bean
>> > class="org.apache.servicemix.components.util.DefaultFileMarshaler"/>
>> > </property>
>> > </bean>
>> > </sm:component>
>> > </sm:activationSpec>
>> > ********************************************************
>> >
>> >
>> > Below is a snippet of my ArchiveExtractor class that uses the
>> ServiceMix
>> > Client API to retrieve the FTPd file, extract the contents, and pass it
>> on
>> > to the next component (FileWriter):
>> >
>> > **********************************************************
>> > public void onMessageExchange(MessageExchange exchange)
>> > throws MessagingException {
>> >
>> > NormalizedMessage message = exchange.getMessage("in");
>> > File zipFile = null;
>> > InputStream in = null;
>> > InOnly inOnlyExchange = null;
>> >
>> > try {
>> > zipFile = writeZipFile(exchange, message); //
>> writes the zip file
>> > in = unpackArchive(zipFile); // returns the Zip
>> file content input
>> > stream
>> > inOnlyExchange = client.createInOnlyExchange();
>> > NormalizedMessage messageToSend =
>> inOnlyExchange.getInMessage();
>> > marshaler.readMessage(inOnlyExchange,
>> messageToSend, in, zipFile
>> > .getCanonicalPath());
>> > } catch (IOException ioe) {
>> > throw new MessagingException(ioe);
>> > } catch (Exception e) {
>> > throw new MessagingException(e);
>> > }
>> > client.sendSync(inOnlyExchange); // fails here
>> > ***********************************************
>> >
>> > Thanks!
>> >
>> > -los
>> >
>> >
>> > gnodet wrote:
>> >>
>> >> Can you try with
>> >> <sm:client id="serviceMixClient" />
>> >> instead of
>> >> <bean id="serviceMixClient"
>> >> class="org.apache.servicemix.client.DefaultServiceMixClient">
>> >>
>> >> This uses the org.apache.servicemix.client.ClientFactoryBean
>> >> spring factory to create a client. The default configuration should
>> >> work in ServiceMix standalone by retrieving the ClientFactory from
>> >> JNDI.
>> >>
>> >> On 10/13/06, moraleslos <[EMAIL PROTECTED]> wrote:
>> >>>
>> >>> I am writing a POJO component that accepts a message, processes, and
>> >>> sends
>> >>> another message back to the bus using the ServiceMixClient api. Now
>> I'm
>> >>> running into a configuration issue where there is a circular
>> reference
>> >>> between the servicemix client bean and my pojo bean. Here is my
>> >>> servicemix.xml:
>> >>>
>> >>> #################
>> >>>
>> >>> ...
>> >>> <bean id="serviceMixClient"
>> >>> class="org.apache.servicemix.client.DefaultServiceMixClient">
>> >>> <constructor-arg ref="jbi"/>
>> >>> </bean>
>> >>> ...
>> >>> <sm:serviceunit id="jbi">
>> >>> <sm:activationSpecs>
>> >>> <sm:activationSpec
>> >>> componentName="FileExtractor"
>> >>> service="foo:FileExtractor"
>> >>> destinationService="foo:FileSender">
>> >>> <sm:component>
>> >>> <bean class="test.servicemix.FileExtractor">
>> >>> <property name="client" ref="serviceMixClient"/>
>> >>> <property name="marshaler">
>> >>> <bean
>> >>> class="org.apache.servicemix.components.util.BinaryFileMarshaler"/>
>> >>> </property>
>> >>> </bean>
>> >>> </sm:component>
>> >>> </sm:activationSpec>
>> >>> ....
>> >>> ##########################################
>> >>>
>> >>>
>> >>> As you can see, the client bean references "jbi", and in the jbi
>> there
>> >>> is a
>> >>> pojo component that references the client... So my question is, how
>> do
>> >>> you
>> >>> configure a POJO component using the Client API in the
>> servicemix.xml?
>> >>> I
>> >>> want to make sure that my FilePoller's (not shown) destination is my
>> >>> POJO
>> >>> component, and my POJO component's destination is the "FileSender"
>> (also
>> >>> not
>> >>> shown).
>> >>>
>> >>> Thanks in advance.
>> >>>
>> >>> -los
>> >>> --
>> >>> View this message in context:
>> >>>
>>
http://www.nabble.com/ServiceMixClient-configuration-help-tf2440104.html#a6804342
>> >>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/ServiceMixClient-configuration-help-tf2440104.html#a6840205
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Cheers,
> Guillaume Nodet
>
>
--
View this message in context:
http://www.nabble.com/ServiceMixClient-configuration-help-tf2440104.html#a6841462
Sent from the ServiceMix - User mailing list archive at Nabble.com.
--
Cheers,
Guillaume Nodet