Search in sources :

Example 1 with Multiplier

use of org.apache.camel.example.server.Multiplier in project camel by apache.

the class CamelClientRemoting method main.

// START SNIPPET: e1
public static void main(final String[] args) {
    System.out.println("Notice this client requires that the CamelServer is already running!");
    AbstractApplicationContext context = new ClassPathXmlApplicationContext("camel-client-remoting.xml");
    // just get the proxy to the service and we as the client can use the "proxy" as it was
    // a local object we are invoking. Camel will under the covers do the remote communication
    // to the remote ActiveMQ server and fetch the response.
    Multiplier multiplier = context.getBean("multiplierProxy", Multiplier.class);
    System.out.println("Invoking the multiply with 33");
    int response = multiplier.multiply(33);
    System.out.println("... the result is: " + response);
    // we're done so let's properly close the application context
    IOHelper.close(context);
}
Also used : AbstractApplicationContext(org.springframework.context.support.AbstractApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) Multiplier(org.apache.camel.example.server.Multiplier)

Example 2 with Multiplier

use of org.apache.camel.example.server.Multiplier in project camel by apache.

the class SpringJmsClientRemotingServerTest method testCamelRemotingInvocation.

@Test
public void testCamelRemotingInvocation() {
    // just get the proxy to the service and we as the client can use the "proxy" as it was
    // a local object we are invoking. Camel will under the covers do the remote communication
    // to the remote ActiveMQ server and fetch the response.
    Multiplier multiplier = appCtx.getBean("multiplierProxy", Multiplier.class);
    int response = multiplier.multiply(33);
    assertEquals("Get a wrong response", 99, response);
}
Also used : Multiplier(org.apache.camel.example.server.Multiplier) Test(org.junit.Test)

Aggregations

Multiplier (org.apache.camel.example.server.Multiplier)2 Test (org.junit.Test)1 AbstractApplicationContext (org.springframework.context.support.AbstractApplicationContext)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1