Ejemplo n.º 1
0
  private void runStubBased() throws Exception {
    String targetEndpoint = toEPR;
    ConfigurationContext configurationContext = generateConfigContext();

    RMInteropServiceStub stub = new RMInteropServiceStub(configurationContext, targetEndpoint);
    ServiceClient stubServiceClient = stub._getServiceClient();

    String acksToAddress = stubServiceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();

    setUpOptions(stubServiceClient.getOptions(), acksToAddress);

    Ping ping = new Ping();
    ping.setText("ping1");
    stub.ping(ping);

    ping = new Ping();
    ping.setText("ping2");
    stub.ping(ping);

    ping = new Ping();
    ping.setText("ping3");
    stub.ping(ping);

    SequenceReport sequenceReport = null;
    boolean complete = false;
    while (!complete) {
      sequenceReport = SandeshaClient.getOutgoingSequenceReport(stubServiceClient);
      if (sequenceReport != null && sequenceReport.getCompletedMessages().size() == 3)
        complete = true;
      else {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e1) {
          e1.printStackTrace();
        }
      }
    }

    Thread.sleep(3000);

    SandeshaClient.terminateSequence(stubServiceClient);

    Thread.sleep(6000);

    stub._getServiceClient().cleanup();
  }
Ejemplo n.º 2
0
  private void run() throws Exception {

    ConfigurationContext configurationContext = generateConfigContext();

    ServiceClient serviceClient = new ServiceClient(configurationContext, null);

    //		String replyAddress = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" +
    // ServiceClient.ANON_OUT_ONLY_OP;
    String acksToAddress = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();

    Options clientOptions = new Options();
    setUpOptions(clientOptions, acksToAddress);

    serviceClient.setOptions(clientOptions);

    serviceClient.fireAndForget(getPingOMBlock("ping1"));
    serviceClient.fireAndForget(getPingOMBlock("ping2"));
    serviceClient.fireAndForget(getPingOMBlock("ping3"));

    boolean complete = false;
    while (!complete) {
      SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
      if (sequenceReport != null && sequenceReport.getCompletedMessages().size() == 3)
        complete = true;
      else {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e1) {
          e1.printStackTrace();
        }
      }
    }

    SandeshaClient.terminateSequence(serviceClient);

    Thread.sleep(3000);

    configurationContext.getListenerManager().stop();
    serviceClient.cleanup();
  }