JBoss Community Archive (Read Only)


Remote Invoker

The RemoteInvoker serves as a remote invocation client for SwitchYard services.  It allows non-SwitchYard applications to invoke any service in SwitchYard which uses a <binding.sca> binding.  It is also used by the internal clustering channel to facilitate intra-cluster communication between instances.

Using the RemoteInvoker

RemoteInvoker and supporting classes can be included in your application via the following Maven dependency:

   <version> <!-- SY version goes here (e.g. 0.8.0.Final) --> </version>

Each instance of SY includes a special context path called "switchyard-remote" which is bound to the default HTTP listener in AS 7.  The initial version of RemoteInvoker supports communication with this endpoint directly.  Here's an example of invoking an in-out service in SY using the HttpInvoker:

public class MyClient {
    public static void main(String[] args) throws Exception {
        RemoteInvoker invoker = new HttpInvoker("http://localhost:8080/switchyard-remote");
        Offer offer = new Offer();
        RemoteMessage msg = invoker.invoke(new RemoteMessage()
            .setContext(new DefaultContext())
            .setService(new QName("urn:com.example.switchyard:remote", "Dealer"))
        Deal deal = (Deal)msg.getContent();
        System.out.println("It's a deal? " + deal.isAccepted());

The remote-invoker quickstart serves as a nice example of using RemoteInvoker with a SwitchYard application.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 09:45:47 UTC, last content change 2013-03-26 16:25:32 UTC.