Here's a code fragment from what I working with. It seems real close, or
maybe it's complete nonsense, one or the other. It runs fine, it create an
endpoint, but no message is received by the receiver component instance.
The context here is obtained from a remote client instance...
receiver = new ReceiverComponent();
ServiceEndpoint receiverEndpoint =
componentContext.activateEndpoint(receiver.SERVICE, receiver.ENDPOINT);
InOnly exchange =
componentContext.getDeliveryChannel().createExchangeFactory().createInOnlyExchange();
NormalizedMessage message = exchange.createMessage();
String xml =
"<s12:Envelope " +
" xmlns:s12='http://www.w3.org/2003/05/soap-envelope'>" +
" <s12:Body>" +
" <data>Hello</data>" +
" </s12:Body>" +
"</s12:Envelope>";
message.setContent(new StringSource(xml));
exchange.setInMessage(message);
exchange.setService(receiver.SERVICE);
exchange.setEndpoint(receiverEndpoint);
serviceMixClient.send(exchange);
// The receiver shows up in this list...
ServiceEndpoint[] endPoints =
componentContext.getEndpoints(null);
Gert Vanthienen wrote:
>
> L.S.,
>
> On this page (http://servicemix.apache.org/client-api.html), you'll find
> an introduction to the ServiceMixClient API. Once you're connected,
> there isn't that much of a difference between the RemoteServiceMixClient
> and the other ServiceMixClient implementations. I'm afraid we don't
> have any additional code samples available on the website, you can take
> a look at our unit test classes at
> http://svn.apache.org/repos/asf/servicemix/smx3/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/
>
> though.
>
> Gert
>
> jsexton0 wrote:
>> I created some code, successfully, using examples I found here and there
>> to
>> create a local JBIContainer instance, a couple components to send and
>> receive messages, hooked them together, and it worked fine.
>>
>> Now I'd like to try using a RemoteServiceMixClient instance. I'd like to
>> create, in my local application code, a sender and a receiver object,
>> hook
>> them up in to a remote Servicemix and pass a message through. I am able
>> to
>> connect to the remote server, and do a few other thing, but I'm a bit
>> foggy
>> on the details of how to do the plumbing on this.
>>
>> RemoteServiceMixClient remoteServiceMixClient = new
>> RemoteServiceMixClient("tcp://192.168.xx.xx:61616");
>> remoteServiceMixClient.init();
>> remoteServiceMixClient.start();
>>
>> This works. And I can get the current endpoints from it.
>> Now, does the following get me anyplace?
>>
>> componentContext = serviceMixClient.getContext();
>> SenderComponent sender = new SenderComponent();
>> componentContext.activateEndpoint(sender.SERVICE, sender.ENDPOINT);
>>
>> Where SenderComponent looks like this...
>>
>> public class SenderComponent extends ComponentSupport implements Sender {
>> public static final QName SERVICE = new
>> QName("http://servicemix.org/example/", "sender");
>> public static final String ENDPOINT = "sender";
>> etc...
>>
>> I'm guessing here... Is there some code around that does this? Thanks
>>
>
>
>
> -----
> ---
> Gert Vanthienen
> http://www.anova.be
>
--
View this message in context:
http://www.nabble.com/RemoteServiceMixClient---Example--tp17657659p17680712.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.