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

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


    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);
View Full Code Here


  public synchronized void send(String replyto_ior, short rval, int rcode,
      byte[] idata, int ilen, int cd, int flags, String type,
      String subtype) {
    log.debug("Received: " + callbackIOR);
    Message message = new Message();
    message.cd = cd;
    message.replyTo = replyto_ior;
    message.flags = flags;
    message.control = null;// TODO
    message.rval = rval;
View Full Code Here

          }
        }
        throw new ConnectionException(Connection.TPETIME,
            "Did not receive a message");
      } else {
        Message message = returnData.remove(0);
        if (message != null) {
          log.debug("Message was available");
          if (message.rval == EventListener.DISCON_CODE) {
            if (JABTransaction.current() != null) {
              try {
View Full Code Here

      }
      if (!receive.getCommand().equals("MESSAGE")) {
        throw new ConnectionException(Connection.TPESYSTEM,
            "Internal error, received unexpected receipt");
      }
      Message convertFromBytesMessage = convertFromBytesMessage(receive);
      convertFromBytesMessage.setManagement(management);
      convertFromBytesMessage.setOutputStream(outputStream);
      convertFromBytesMessage.setMessageId(receive.getHeaders().get(
          "message-id"));
      log.debug("Returning message from: " + destinationName);
      return convertFromBytesMessage;
    } catch (ConnectionException e) {
      throw e;
View Full Code Here

    if (!canRecv) {
      throw new ConnectionException(Connection.TPEPROTO,
          "Session can't receive");
    }
    Message m = receiver.receive(flags);
    // Prepare the outbound channel
    if (m.replyTo == null
        || (sender != null && !m.replyTo.equals(sender.getSendTo()))) {
      log.trace("Send to location has altered");
      sender.close();
View Full Code Here

  public void run() {
    log.debug("Running");

    while (!closed) {
      Message message = null;
      try {
        message = receiver.receive(0);
        log.trace("Received");
      } catch (ConnectionException e) {
        if (closed) {
          log.trace(
              "Got an exception during close: " + e.getMessage(),
              e);
          break;
        }
        if (e.getTperrno() == Connection.TPETIME) {
          log.debug("Got a timeout");
        } else {
          log.error(
              "Could not receive the message: " + e.getMessage(),
              e);
          break;
        }
      }

      synchronized (closeLock) {
        if (message != null) {
          if (closed) {
            log.warn("Message will be ignored as closing");
          } else {
            try {

              this.processMessage(serviceName, message);
              log.trace("Processed");
            } catch (Throwable t) {
              log.error("Can't process the message", t);
            }

            try {
              // Assumes the message was received from stomp -
              // fair
              // assumption outside of an MDB
              message.ack();
            } catch (IOException t) {
              log.error("Can't ack the message", t);
            }
          }
        }
View Full Code Here

        "JAVA_Converse", false);
    Sender clientSender = clientTransport.getSender("JAVA_Converse", false);
    Receiver clientReceiver = clientTransport.createReceiver(1, null);
    clientSender.send(clientReceiver.getReplyTo(), (short) 1, 1,
        "hi".getBytes(), 2, 0, 0, 0, "X_OCTET", null);
    Message receive = serviceDispatcher.receive(0);
    receive.ack();
    assertTrue(receive.len == 2);

    Sender serviceSender = serviceTransport.createSender(receive.replyTo);
    Receiver serviceReceiver = serviceTransport.createReceiver(1, null);

    log.info("Chatting");
    for (int i = 0; i < 100; i++) {
      String toSend = String.valueOf(i);
      serviceSender.send(serviceReceiver.getReplyTo(), (short) 1, 1,
          toSend.getBytes(), toSend.length(), 0, 0, 0, "X_OCTET",
          null);
      Message receive2 = clientReceiver.receive(0);
      assertTrue(receive2.len == toSend.length());
      String received = new String(receive2.data);
      assertTrue(received + " " + toSend, received.equals(toSend));
    }
    log.info("Chatted");
View Full Code Here

    Receiver endpoint = temporaryQueues.get(cd);
    if (endpoint == null) {
      throw new ConnectionException(Connection.TPEBADDESC,
          "Session does not exist: " + cd);
    }
    Message message = endpoint.receive(flags);
    Buffer buffer = null;
    if (message.type != null && !message.type.equals("")) {
      buffer = tpalloc(message.type, message.subtype, message.len);
      buffer.deserialize(message.data);
    }
View Full Code Here

TOP

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

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.