Examples of MsgBoxClient


Examples of edu.indiana.extreme.www.xgws.msgbox.client.MsgBoxClient

      fill = fill + fill;
    }

    System.out.println("fill size : " + fill.length());

    MsgBoxClient user = new MsgBoxClient();

    EndpointReference msgBoxEpr = user.createMessageBox(
        "http://localhost:8080/axis2/services/MsgBoxService", 5000L);
    /*
     * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
     * StringReader( "<test>simple test message 1</test>")));
     * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
     * StringReader( "<test>simple test message 2</test>")));
     * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
     * StringReader( "<test>simple test message 3</test>")));
     * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
     * StringReader( "<test>simple test message 4</test>")));
     */

    EndpointReference msgBoxEprTcpMon = new EndpointReference(msgBoxEpr
        .getAddress().replace("8080", "5050"));

    for (int i = 0; i < 10; i++) {
      String msg = String.format(
          "<msg><seq>%d</seq><fill>%s</fill></msg>", i, fill);

      user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
          .reader2OMElement(new StringReader(msg)));

      Thread.sleep(200L);
    }

    Iterator<OMElement> iterator = null;

    try {
      iterator = user.takeMessagesFromMsgBox(msgBoxEprTcpMon, 5000L);
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (iterator != null)
      while (iterator.hasNext()) {

        System.out.println(iterator.next().toStringWithConsume());
      }

    System.out.println("Delete message box response :  "
        + user.deleteMsgBox(msgBoxEpr, 5000L));
  }
View Full Code Here

Examples of edu.indiana.extreme.www.xgws.msgbox.client.MsgBoxClient

  @Test
  public void testMessageBox() throws Exception {

    String msgBoxId = UUID.randomUUID().toString();
    MsgBoxClient  user = new MsgBoxClient();

    //test publish with Epr
    EndpointReference msgBoxEpr = user.createMessageBox("http://localhost:"+port+"/axis2/services/MsgBoxService", 500L);
   
    System.out.println(msgBoxEpr.toString());
    user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
        .reader2OMElement(new StringReader(
            "<test>A simple test message</test>")));
   
   
   
    Iterator<OMElement> iterator = user.takeMessagesFromMsgBox(msgBoxEpr,
        500L);
    int i = 0;
    if (iterator != null)
      while (iterator.hasNext()) {
        i++;
        System.out.println("Retrieved message :" + i);
        System.out.println(iterator.next().toStringWithConsume());
      }

    System.out.println("Delete message box response :  "
        + user.deleteMsgBox(msgBoxEpr, 500L));
   
    //test invocations with id encoded in the Url
    msgBoxId = UUID.randomUUID().toString();
    user = new MsgBoxClient();

    //test publish with Epr
    msgBoxEpr = user.createMessageBox("http://localhost:"+port+"/axis2/services/MsgBoxService", 500L);
   
    String mesgboxUrl = "http://localhost:"+port+"/axis2/services/MsgBoxService/clientid/"+msgBoxId;
   
    ServiceClient client = new ServiceClient();
    client.getOptions().setTo(new EndpointReference(mesgboxUrl));
   
    OMElement request = OMAbstractFactory.getOMFactory().createOMElement(new QName("foo"));
    request.setText("bar");
    client.sendReceive(request);
   
    iterator = user.takeMessagesFromMsgBox(new EndpointReference(mesgboxUrl),500L);
    assertTrue(iterator.hasNext());
    iterator.next();
    assertFalse(iterator.hasNext());
   
    System.out.println("All tests Done");
View Full Code Here

Examples of edu.indiana.extreme.www.xgws.msgbox.client.MsgBoxClient

      System.out
          .println("unable to load configurations defaults will be used");
    }

    String msgBoxId = UUID.randomUUID().toString();
    MsgBoxClient client = new MsgBoxClient();

    EndpointReference msgBoxEpr = client.createMessageBox(configurations
        .getProperty(ConfigKeys.MSGBOX_SERVICE_URL), 500L);

    try {
      client.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
          .reader2OMElement(new StringReader(
              "<test>A simple test message</test>")));
    } catch (XMLStreamException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Iterator<OMElement> iterator = client.takeMessagesFromMsgBox(msgBoxEpr,
        500L);
    int i = 0;
    if (iterator != null)
      while (iterator.hasNext()) {
        i++;
        System.out.println("Retrieved message :" + i);
        try {
          System.out.println(iterator.next().toStringWithConsume());
        } catch (XMLStreamException e) {
          e.printStackTrace();
        }
      }

    System.out.println("Delete message box response :  "
        + client.deleteMsgBox(msgBoxEpr, 500L));
  }
View Full Code Here

Examples of org.apache.airavata.wsmg.msgbox.client.MsgBoxClient

    }

    @Test
    public void testMessageBox() throws Exception {

        MsgBoxClient user = new MsgBoxClient();
        StringBuilder builder = new StringBuilder();
        port = InMemoryMessageBoxServer.TESTING_PORT;
        EndpointReference msgBoxEpr = user.createMessageBox("http://localhost:" + port
                + "/axis2/services/MsgBoxService", timeout);

        for (int i = 0; i < 10; i++) {

            builder.delete(0, builder.capacity());
            Random x = new Random();
            for (int j = 0; j < x.nextInt(50); j++) {
                builder.append("123456789");
            }

            String msg = String.format("<msg><seq>%d</seq><fill>%s</fill></msg>", i, builder.toString());

            user.storeMessage(msgBoxEpr, timeout, MsgBoxUtils.reader2OMElement(new StringReader(msg)));

            Thread.sleep(200L);
        }

        Iterator<OMElement> iterator = null;

        try {
            iterator = user.takeMessagesFromMsgBox(msgBoxEpr, timeout);
        } catch (Exception e) {
            e.printStackTrace();
        }

        if (iterator != null)
            while (iterator.hasNext()) {
                System.out.println(iterator.next().toStringWithConsume());
            }

        System.out.println("Delete message box response :  " + user.deleteMsgBox(msgBoxEpr, 5000L));
    }
View Full Code Here

Examples of org.apache.airavata.wsmg.msgbox.client.MsgBoxClient

    }

    @Test
    public void testMessageBox() throws Exception {

        MsgBoxClient user = new MsgBoxClient();
        port = InMemoryMessageBoxServer.TESTING_PORT;
        // test publish with Epr
        EndpointReference msgBoxEpr = user.createMessageBox("http://localhost:" + port
                + "/axis2/services/MsgBoxService", timeout);

        System.out.println(msgBoxEpr.toString());
        user.storeMessage(msgBoxEpr, timeout,
                MsgBoxUtils.reader2OMElement(new StringReader("<test>A simple test message</test>")));

        Iterator<OMElement> iterator = user.takeMessagesFromMsgBox(msgBoxEpr, timeout);
        int i = 0;
        if (iterator != null)
            while (iterator.hasNext()) {
                i++;
                System.out.println("Retrieved message :" + i);
                System.out.println(iterator.next().toStringWithConsume());
            }


        // test invocations with id encoded in the Url
//        port = InMemoryMessageBoxServer.getAvailablePort();
//        user = new MsgBoxClient();
//        msgBoxEpr = user.createMessageBox("http://localhost:" + port + "/axis2/services/MsgBoxService", timeout);
        String msgBoxId = UUID.randomUUID().toString();
        String address = msgBoxEpr.getAddress();
        int biginIndex = address.indexOf("clientid");
        if (biginIndex != -1) {
            msgBoxId = address.substring(biginIndex + "clientid".length() + 1);
        }
        System.out.println("MSGBOX ID:" + msgBoxId);

        String mesgboxUrl = "http://localhost:" + port + "/axis2/services/MsgBoxService/clientid/" + msgBoxId;

        OMElement request = OMAbstractFactory.getOMFactory().createOMElement(new QName("foo"));
        request.setText("bar");
        ServiceClient client = null;

        try {
            client = new ServiceClient();
            System.out.println(mesgboxUrl);
            client.getOptions().setTo(new EndpointReference(mesgboxUrl));
            OMElement response = client.sendReceive(request);
        } finally {
            client.cleanupTransport();
        }

        iterator = user.takeMessagesFromMsgBox(new EndpointReference(mesgboxUrl), timeout);
        assertTrue(iterator.hasNext());
        while (iterator.hasNext()) {
            i++;
            System.out.println("Retrieved message :" + i);
            System.out.println(iterator.next().toStringWithConsume());
        }
        assertFalse(iterator.hasNext());

        System.out.println("Delete message box response :  " + user.deleteMsgBox(msgBoxEpr, timeout));
        System.out.println("All tests Done");

    }
View Full Code Here

Examples of org.apache.airavata.wsmg.msgbox.client.MsgBoxClient

      System.out.println("unable to load configuration file, "
          + "default settings will be used");
    }

    String msgBoxId = UUID.randomUUID().toString();
    MsgBoxClient client = new MsgBoxClient();

    EndpointReference msgBoxEpr = client.createMessageBox(configurations
        .getProperty(ConfigKeys.MSGBOX_SERVICE_URL), 500L);

    try {
      client.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
          .reader2OMElement(new StringReader(
              "<test>A simple test message</test>")));
    } catch (XMLStreamException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Iterator<OMElement> iterator = client.takeMessagesFromMsgBox(msgBoxEpr,
        500L);
    int i = 0;
    if (iterator != null)
      while (iterator.hasNext()) {
        i++;
View Full Code Here

Examples of org.apache.airavata.wsmg.msgbox.client.MsgBoxClient

public class MsgboxHandler {

    protected MsgBoxClient msgBoxUser = null;

    public EndpointReference createPullMsgBox(String msgBoxLocation, long timeout) throws MsgBrokerClientException {
        msgBoxUser = new MsgBoxClient();
        EndpointReference msgBoxAddr = null;

        try {
            msgBoxAddr = msgBoxUser.createMessageBox(msgBoxLocation, timeout);
        } catch (RemoteException e) {
View Full Code Here

Examples of org.apache.airavata.wsmg.msgbox.client.MsgBoxClient

        if ((msgBoxAddr.getAllReferenceParameters() == null || msgBoxAddr.getAllReferenceParameters()
                .get(MsgBoxQNameConstants.MSG_BOXID_QNAME).getText() == null)
                && biginIndex == -1)
            throw new MsgBrokerClientException("Invalid Message Box Address");
        this.msgBoxUser = new MsgBoxClient();
        MessagePuller messagePuller = new MessagePuller(msgBoxUser, msgBoxAddr, handler, interval, timeout);
        messagePuller.startPulling();
        return messagePuller;
    }
View Full Code Here

Examples of org.apache.airavata.wsmg.msgbox.client.MsgBoxClient

            formattedEventSink = String.format(format, msgBoxEventSink, msgBoxId);

        }

        if (this.msgBoxUser == null) {
            this.msgBoxUser = new MsgBoxClient();
        }

        String resp = null;
        try {
            resp = msgBoxUser.deleteMsgBox(msgBoxEpr, timeout);
View Full Code Here

Examples of org.apache.airavata.wsmg.msgbox.client.MsgBoxClient

    public MsgBoxWsaResponsesCorrelator(String msgBoxServiceLoc,AsynchronousInvoker output)
        throws DynamicInfosetProcessorException
    {
        this.invoker = output;
        this.msgBoxServiceLoc = msgBoxServiceLoc;
        msgBoxClient = new MsgBoxClient();
        try {
            msgBoxAddr = msgBoxClient.createMessageBox(msgBoxServiceLoc,5000L);
            try {
                setReplyTo(new WsaEndpointReference(new URI(msgBoxAddr.getAddress())));
            } catch (URISyntaxException e) {
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.