Package javax.jbi.messaging

Examples of javax.jbi.messaging.InOut.createMessage()


            public void run() {

                try {
                    InOut me = (InOut) channel.accept(10000);
                    NormalizedMessage nm = me.createMessage();
                    nm.setContent(new StringSource("<response>" + counter
                            + "</response>"));
                    me.setOutMessage(nm);
                    channel.sendSync(me);
View Full Code Here


       
        for (int i = 0; i < 6; i++) {
          
            MessageExchangeFactory factory = channel.createExchangeFactoryForService(new QName("service"));
            InOut me = factory.createInOutExchange();
            NormalizedMessage nm = me.createMessage();
            nm.setContent(new StringSource("<request>" + i + "</request>"));
            me.setInMessage(nm);
            Thread t = new ProviderThread(i, channel);
            t.start();
            long before = System.currentTimeMillis();
View Full Code Here

 
  public void testInOut() throws Exception {
    // Send message exchange
    MessageExchangeFactory mef = consumer.getChannel().createExchangeFactory(endpoint);
    InOut mec = mef.createInOutExchange();
    NormalizedMessage m = mec.createMessage();
    m.setContent(new StreamSource(new ByteArrayInputStream(PAYLOAD.getBytes())));
    mec.setInMessage(m);
    consumer.getChannel().send(mec);
    // Provider side
    InOut mep = (InOut) provider.getChannel().accept(10L);
View Full Code Here

    consumer.getChannel().send(mec);
    // Provider side
    InOut mep = (InOut) provider.getChannel().accept(10L);
    assertNotNull(mep);
    assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
    m = mep.createMessage();
    m.setContent(new StreamSource(new ByteArrayInputStream(RESPONSE.getBytes())));
    mep.setOutMessage(m);
    provider.getChannel().send(mep);
    // Consumer side
    assertSame(mec, consumer.getChannel().accept(10L));
View Full Code Here

        try {
          // Provider side
          InOut mep = (InOut) provider.getChannel().accept(10000L);
          assertNotNull(mep);
          assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
          NormalizedMessage m = mep.createMessage();
          m.setContent(new StreamSource(new ByteArrayInputStream(RESPONSE.getBytes())));
          mep.setOutMessage(m);
          provider.getChannel().send(mep);
        } catch (Exception e) {
          e.printStackTrace();
View Full Code Here

      }
    }).start();
    // Send message exchange
    MessageExchangeFactory mef = consumer.getChannel().createExchangeFactory(endpoint);
    InOut mec = mef.createInOutExchange();
    NormalizedMessage m = mec.createMessage();
    m.setContent(new StreamSource(new ByteArrayInputStream(PAYLOAD.getBytes())));
    mec.setInMessage(m);
    consumer.getChannel().sendSync(mec, 10000L);
    assertEquals(ExchangeStatus.ACTIVE, mec.getStatus());
    mec.setStatus(ExchangeStatus.DONE);
View Full Code Here

        try {
          // Provider side
          InOut mep = (InOut) provider.getChannel().accept(10000L);
          assertNotNull(mep);
          assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
          NormalizedMessage m = mep.createMessage();
          m.setContent(new StreamSource(new ByteArrayInputStream(RESPONSE.getBytes())));
          mep.setOutMessage(m);
          provider.getChannel().sendSync(mep);
          assertEquals(ExchangeStatus.DONE, mep.getStatus());
        } catch (Exception e) {
View Full Code Here

    });
    t.start();
    // Send message exchange
    MessageExchangeFactory mef = consumer.getChannel().createExchangeFactory(endpoint);
    InOut mec = mef.createInOutExchange();
    NormalizedMessage m = mec.createMessage();
    m.setContent(new StreamSource(new ByteArrayInputStream(PAYLOAD.getBytes())));
    mec.setInMessage(m);
    consumer.getChannel().sendSync(mec, 10000L);
    assertEquals(ExchangeStatus.ACTIVE, mec.getStatus());
    mec.setStatus(ExchangeStatus.DONE);
View Full Code Here

 
  public void testInOutWithFault() throws Exception {
    // Send message exchange
    MessageExchangeFactory mef = consumer.getChannel().createExchangeFactory(endpoint);
    InOut mec = mef.createInOutExchange();
    NormalizedMessage m = mec.createMessage();
    m.setContent(new StreamSource(new ByteArrayInputStream(PAYLOAD.getBytes())));
    mec.setInMessage(m);
    consumer.getChannel().send(mec);
    // Provider side
    InOut mep = (InOut) provider.getChannel().accept(10L);
View Full Code Here

    consumer.getChannel().send(mec);
    // Provider side
    InOut mep = (InOut) provider.getChannel().accept(10L);
    assertNotNull(mep);
    assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
    m = mep.createMessage();
    m.setContent(new StreamSource(new ByteArrayInputStream(RESPONSE.getBytes())));
    mep.setStatus(ExchangeStatus.ERROR);
    provider.getChannel().send(mep);
    // Consumer side
    assertSame(mec, consumer.getChannel().accept(10L));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.