Package org.jboss.narayana.blacktie.jatmibroker.core.transport

Examples of org.jboss.narayana.blacktie.jatmibroker.core.transport.Transport


  public void test() throws Exception {
    AtmiBrokerEnvXML xml = new AtmiBrokerEnvXML();
    Properties properties = xml.getProperties();

    TransportFactory factory = new TransportFactory(properties);
    Transport proxy = factory.createTransport();
    Sender serviceFactory = proxy.getSender("BAR", false);

    String aString = "Hello from Java Land";
    Receiver endpoint = proxy.createReceiver(1, null);
    serviceFactory.send(endpoint.getReplyTo(), (short) 0, 0,
        aString.getBytes(), aString.getBytes().length, 0, 0, 0,
        "X_OCTET", "");
    Message receive = endpoint.receive(0);

    assertNotNull(receive);
    String string = new String(receive.data).intern();
    String expectedResponse = "BAR SAYS HELLO";
    log.debug("Bar ServiceManager service_request response is " + string);
    log.debug("Bar ServiceManager service_request size of response is "
        + receive.len);
    assertEquals(string, expectedResponse);
    proxy.close();
    factory.close();
  }
View Full Code Here


    int correlationId = 0;
    synchronized (this) {
      correlationId = ++nextId;
      log.trace("Allocated next sessionId: " + correlationId);
    }
    Transport transport = getTransport(svc);
    Receiver endpoint = transport.createReceiver(correlationId,
        responseMonitor);
    temporaryQueues.put(correlationId, endpoint);
    log.trace("Added a queue for: " + correlationId);
    // TODO HANDLE TRANSACTION
    String type = null;
    String subtype = null;
    int len = 0;
    byte[] data = null;
    if (toSend != null) {
      data = toSend.serialize();
      type = toSend.getType();
      subtype = toSend.getSubtype();
      len = toSend.getLen();
    }

    String timeToLive = properties.getProperty("TimeToLive");
    int ttl = 0;

    // Don't set ttl when tpacall and TPNOREPLY set
    if (timeToLive != null
        && ((flags & Connection.TPNOREPLY) != Connection.TPNOREPLY)) {
      ttl = Integer.parseInt(timeToLive) * 1000;
      log.debug("Set ttl: " + ttl);
    }
    transport.getSender(svc, false).send(endpoint.getReplyTo(), (short) 0,
        0, data, len, correlationId, flags, ttl, type, subtype);
    if ((flags & Connection.TPNOREPLY) == Connection.TPNOREPLY) {
      correlationId = 0;
    }
    log.debug("Returning cd: " + correlationId);
View Full Code Here

        Math.min(Connection.XATMI_SERVICE_NAME_LENGTH, svc.length()));
    int correlationId = 0;
    synchronized (this) {
      correlationId = nextId++;
    }
    Transport transport = getTransport(svc);
    Session session = new Session(this, svc, transport, correlationId);

    Receiver receiver = session.getReceiver();
    // TODO HANDLE TRANSACTION
    String type = null;
View Full Code Here

      log.debug("Closed open service session");
    }

    Iterator<Transport> transports = this.transports.values().iterator();
    while (transports.hasNext()) {
      Transport transport = transports.next();
      log.debug("closing transport");
      transport.close();
      log.debug("closed transport");
    }
    this.transports.clear();
    this.connectionFactory.removeConnection(this);
    transportFactory.close();
View Full Code Here

    log.debug("Close connection finished");
  }

  private Transport getTransport(String serviceName)
      throws ConnectionException {
    Transport toReturn = transports.get(serviceName);
    if (toReturn == null) {
      toReturn = transportFactory.createTransport();
      transports.put(serviceName, toReturn);
    }
    return toReturn;
View Full Code Here

    if (serviceSession != null) {
      throw new ConnectionException(Connection.TPEPROTO,
          "Second service session creation attempt, was: "
              + serviceSession.getCd() + " new: " + cd);
    }
    Transport transport = getTransport(name);
    serviceSession = new Session(this, transport, cd, replyTo);
    log.trace("Created the service session: " + cd);
    return serviceSession;
  }
View Full Code Here

TOP

Related Classes of org.jboss.narayana.blacktie.jatmibroker.core.transport.Transport

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.