Package org.mule.jbi

Examples of org.mule.jbi.TestComponent


    container.setWorkingDir(new File("target/.mule-jbi"));
    // Initialize jbi
    container.initialize();
    // Create components
    AgilaComponent provider = new AgilaComponent();
    TestComponent consumer = new TestComponent();
    // Register components
    container.getRegistry().addTransientEngine("consumer", consumer);
    Engine agila = container.getRegistry().addTransientEngine("provider", provider, new AgilaBootstrap());
    // Start jbi
    container.start();
    // Deploy service unit
    URL url = Thread.currentThread().getContextClassLoader().getResource("loanbroker/process.xml");
    File loanbroker = new File(url.toURI()).getParentFile();
    container.getRegistry().addTransientUnit("loanbroker", agila, loanbroker.getAbsolutePath());
    // Send message exchange
    MessageExchangeFactory mef = consumer.getChannel().createExchangeFactory();
    InOnly me = mef.createInOnlyExchange();
    me.setInterfaceName(new QName("http://www.apache.org/agila/samples/exemple1/definition/", "loanService"));
    me.setOperation(new QName("http://www.apache.org/agila/samples/exemple1/definition/", "request"));
    NormalizedMessage m = me.createMessage();
        Document doc = DocumentHelper.createDocument();
        Element msg = doc.addElement("message");
        msg.addElement("firstName").setText("john");
        msg.addElement("lastName").setText("doe");
        msg.addElement("amount").setText("5000");
    m.setContent(new DocumentSource(msg));
    me.setInMessage(m);
    consumer.getChannel().send(me);
  }
View Full Code Here

TOP

Related Classes of org.mule.jbi.TestComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.