You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Sebastian Gomez <sa...@gmail.com> on 2008/06/24 10:01:43 UTC

Send exchange to Endpoint (not Service)

Hi.

I'd like to send an exchange to a specific endpoint from a
servicemix-bean POJO. I've only seen exchanges sent to services, but
(correct me if I'm wrong) it is possible to have more than one
endpoint for each service. How can I specify which particular endpoint
I want to consume my message?

Thanks in advance.

Sebastian Gomez.

Re: Send exchange to Endpoint (not Service)

Posted by Sebastian Gomez <sa...@gmail.com>.
I had forgotten about the annotations! I can confirm it works.

Thanks a lot.

Sebastian Gomez.

On Tue, Jun 24, 2008 at 5:56 PM, Guillaume Nodet <gn...@gmail.com> wrote:
> Try as shown in the example at:
>  http://servicemix.apache.org/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ConsumerBean.html
>
> On Tue, Jun 24, 2008 at 5:07 PM, Sebastian Gomez <sa...@gmail.com> wrote:
>> Hi.
>>
>> Thanks for the answer. The thing is that the component context is not
>> being injected to the POJO. If I do "getContext().getEndpoint(...,...)
>> I get a NullPointerException because the context is null. How is it
>> supposed to be injected? The "context="#context"" which is used in
>> servicemix-cxfse doesn't work in servicemix-bean. Does the
>> componentContext have to be injected explicitly? If so, how can it be
>> done?
>>
>> Sebastian Gomez.
>>
>> On Tue, Jun 24, 2008 at 4:44 PM, Guillaume Nodet <gn...@gmail.com> wrote:
>>> You need to use the ComponentContext injected in your pojo to retrieve
>>> a reference to the endpoint.
>>> This can be done on the ComponentContext using different methods, one
>>> of those being getEndpoint (see
>>> http://java.sun.com/integration/1.0/docs/sdk/api/javax/jbi/component/ComponentContext.html
>>> for more).  This returns a ServiceEnpoint that you can set on the
>>> exchange using setEndpoint instead of using the setService.
>>>
>>> On Tue, Jun 24, 2008 at 4:03 PM, Sebastian Gomez <sa...@gmail.com> wrote:
>>>> I've seen that maybe using the #context it could work, but it's still
>>>> not working for servicemix-bean isn't it? I'd have to go into
>>>> servicemix-cxfse wouldn't I? There must be some way to do it in
>>>> servicemix-bean!
>>>>
>>>> All ideas are welcome.
>>>>
>>>> Sebastian Gomez.
>>>>
>>>> On Tue, Jun 24, 2008 at 10:01 AM, Sebastian Gomez <sa...@gmail.com> wrote:
>>>>> Hi.
>>>>>
>>>>> I'd like to send an exchange to a specific endpoint from a
>>>>> servicemix-bean POJO. I've only seen exchanges sent to services, but
>>>>> (correct me if I'm wrong) it is possible to have more than one
>>>>> endpoint for each service. How can I specify which particular endpoint
>>>>> I want to consume my message?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> Sebastian Gomez.
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> Guillaume Nodet
>>> ------------------------
>>> Blog: http://gnodet.blogspot.com/
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: Send exchange to Endpoint (not Service)

Posted by Guillaume Nodet <gn...@gmail.com>.
Try as shown in the example at:
  http://servicemix.apache.org/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ConsumerBean.html

On Tue, Jun 24, 2008 at 5:07 PM, Sebastian Gomez <sa...@gmail.com> wrote:
> Hi.
>
> Thanks for the answer. The thing is that the component context is not
> being injected to the POJO. If I do "getContext().getEndpoint(...,...)
> I get a NullPointerException because the context is null. How is it
> supposed to be injected? The "context="#context"" which is used in
> servicemix-cxfse doesn't work in servicemix-bean. Does the
> componentContext have to be injected explicitly? If so, how can it be
> done?
>
> Sebastian Gomez.
>
> On Tue, Jun 24, 2008 at 4:44 PM, Guillaume Nodet <gn...@gmail.com> wrote:
>> You need to use the ComponentContext injected in your pojo to retrieve
>> a reference to the endpoint.
>> This can be done on the ComponentContext using different methods, one
>> of those being getEndpoint (see
>> http://java.sun.com/integration/1.0/docs/sdk/api/javax/jbi/component/ComponentContext.html
>> for more).  This returns a ServiceEnpoint that you can set on the
>> exchange using setEndpoint instead of using the setService.
>>
>> On Tue, Jun 24, 2008 at 4:03 PM, Sebastian Gomez <sa...@gmail.com> wrote:
>>> I've seen that maybe using the #context it could work, but it's still
>>> not working for servicemix-bean isn't it? I'd have to go into
>>> servicemix-cxfse wouldn't I? There must be some way to do it in
>>> servicemix-bean!
>>>
>>> All ideas are welcome.
>>>
>>> Sebastian Gomez.
>>>
>>> On Tue, Jun 24, 2008 at 10:01 AM, Sebastian Gomez <sa...@gmail.com> wrote:
>>>> Hi.
>>>>
>>>> I'd like to send an exchange to a specific endpoint from a
>>>> servicemix-bean POJO. I've only seen exchanges sent to services, but
>>>> (correct me if I'm wrong) it is possible to have more than one
>>>> endpoint for each service. How can I specify which particular endpoint
>>>> I want to consume my message?
>>>>
>>>> Thanks in advance.
>>>>
>>>> Sebastian Gomez.
>>>>
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Send exchange to Endpoint (not Service)

Posted by Sebastian Gomez <sa...@gmail.com>.
Hi.

Thanks for the answer. The thing is that the component context is not
being injected to the POJO. If I do "getContext().getEndpoint(...,...)
I get a NullPointerException because the context is null. How is it
supposed to be injected? The "context="#context"" which is used in
servicemix-cxfse doesn't work in servicemix-bean. Does the
componentContext have to be injected explicitly? If so, how can it be
done?

Sebastian Gomez.

On Tue, Jun 24, 2008 at 4:44 PM, Guillaume Nodet <gn...@gmail.com> wrote:
> You need to use the ComponentContext injected in your pojo to retrieve
> a reference to the endpoint.
> This can be done on the ComponentContext using different methods, one
> of those being getEndpoint (see
> http://java.sun.com/integration/1.0/docs/sdk/api/javax/jbi/component/ComponentContext.html
> for more).  This returns a ServiceEnpoint that you can set on the
> exchange using setEndpoint instead of using the setService.
>
> On Tue, Jun 24, 2008 at 4:03 PM, Sebastian Gomez <sa...@gmail.com> wrote:
>> I've seen that maybe using the #context it could work, but it's still
>> not working for servicemix-bean isn't it? I'd have to go into
>> servicemix-cxfse wouldn't I? There must be some way to do it in
>> servicemix-bean!
>>
>> All ideas are welcome.
>>
>> Sebastian Gomez.
>>
>> On Tue, Jun 24, 2008 at 10:01 AM, Sebastian Gomez <sa...@gmail.com> wrote:
>>> Hi.
>>>
>>> I'd like to send an exchange to a specific endpoint from a
>>> servicemix-bean POJO. I've only seen exchanges sent to services, but
>>> (correct me if I'm wrong) it is possible to have more than one
>>> endpoint for each service. How can I specify which particular endpoint
>>> I want to consume my message?
>>>
>>> Thanks in advance.
>>>
>>> Sebastian Gomez.
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: Send exchange to Endpoint (not Service)

Posted by Guillaume Nodet <gn...@gmail.com>.
You need to use the ComponentContext injected in your pojo to retrieve
a reference to the endpoint.
This can be done on the ComponentContext using different methods, one
of those being getEndpoint (see
http://java.sun.com/integration/1.0/docs/sdk/api/javax/jbi/component/ComponentContext.html
for more).  This returns a ServiceEnpoint that you can set on the
exchange using setEndpoint instead of using the setService.

On Tue, Jun 24, 2008 at 4:03 PM, Sebastian Gomez <sa...@gmail.com> wrote:
> I've seen that maybe using the #context it could work, but it's still
> not working for servicemix-bean isn't it? I'd have to go into
> servicemix-cxfse wouldn't I? There must be some way to do it in
> servicemix-bean!
>
> All ideas are welcome.
>
> Sebastian Gomez.
>
> On Tue, Jun 24, 2008 at 10:01 AM, Sebastian Gomez <sa...@gmail.com> wrote:
>> Hi.
>>
>> I'd like to send an exchange to a specific endpoint from a
>> servicemix-bean POJO. I've only seen exchanges sent to services, but
>> (correct me if I'm wrong) it is possible to have more than one
>> endpoint for each service. How can I specify which particular endpoint
>> I want to consume my message?
>>
>> Thanks in advance.
>>
>> Sebastian Gomez.
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Send exchange to Endpoint (not Service)

Posted by Sebastian Gomez <sa...@gmail.com>.
I've seen that maybe using the #context it could work, but it's still
not working for servicemix-bean isn't it? I'd have to go into
servicemix-cxfse wouldn't I? There must be some way to do it in
servicemix-bean!

All ideas are welcome.

Sebastian Gomez.

On Tue, Jun 24, 2008 at 10:01 AM, Sebastian Gomez <sa...@gmail.com> wrote:
> Hi.
>
> I'd like to send an exchange to a specific endpoint from a
> servicemix-bean POJO. I've only seen exchanges sent to services, but
> (correct me if I'm wrong) it is possible to have more than one
> endpoint for each service. How can I specify which particular endpoint
> I want to consume my message?
>
> Thanks in advance.
>
> Sebastian Gomez.
>