Package com.sun.messaging.jmq.io

Examples of com.sun.messaging.jmq.io.Packet


                    // we dont care if we are about to notify
                    sessionLockNotify = false;
                }
                if (session.isBusy() && !stopped) {
                       // cool, we have something to do
                       Packet p = new Packet();

                       // retrieve the next packet and its ConsumerUID
                       ConsumerUID uid = session.fillNextPacket(p);

                       if (uid == null) {
View Full Code Here


        if (block) {
            con.cleanupConnection();
        }
        boolean destroy = false;
        if (msg.getSendAcknowledge()) {
             Packet pkt = new Packet(con.useDirectBuffers());
             pkt.setPacketType(PacketType.GOODBYE_REPLY);
             pkt.setConsumerID(msg.getConsumerID());
             Hashtable hash = new Hashtable();
             hash.put("JMQStatus", new Integer(Status.OK));
             if (((IMQBasicConnection)con).getDumpPacket() ||
                 ((IMQBasicConnection)con).getDumpOutPacket())
                 hash.put("JMQReqID", msg.getSysMessageID().toString());
             pkt.setProperties ( hash );
             con.sendControlMessage(pkt);
             // increase timeout
             if (con.isBlocking()) {
     if (con instanceof IMQBasicConnection)  {
         IMQBasicConnection ipCon = (IMQBasicConnection)con;
View Full Code Here

        int status = Status.OK;
        String errMsg = null;

  // Send reply
  Packet reply = new Packet(con.useDirectBuffers());
  reply.setPacketType(PacketType.OBJECT_MESSAGE);

        HAMonitorService hamonitor = Globals.getHAMonitorService();
        if (hamonitor != null && hamonitor.inTakeover()) {
            status = Status.ERROR;
            errMsg =  rb.getString(rb.E_CANNOT_PROCEED_TAKEOVER_IN_PROCESS);
View Full Code Here

        int status = Status.OK;
        String errMsg = null;

  // Send reply
  Packet reply = new Packet(con.useDirectBuffers());
  reply.setPacketType(PacketType.OBJECT_MESSAGE);

        HAMonitorService hamonitor = Globals.getHAMonitorService();
        if (hamonitor != null && hamonitor.inTakeover()) {
            status = Status.ERROR;
            errMsg =  rb.getString(rb.E_CANNOT_PROCEED_TAKEOVER_IN_PROCESS);
View Full Code Here

        Iterator itr = ids.iterator();
        while (itr.hasNext()) {
            SysMessageID id = (SysMessageID)itr.next();
            PacketReference ref = Destination.get(id);
            if (ref == null) continue;
            Packet realp = ref.getPacket();
            if (ref.isInvalid()) continue;
            Packet p = new Packet(false /* use direct buffers */);
            p.fill(realp);
            p.setConsumerID(cid);
            returnlist.add(p);
        }
        return returnlist;
    }
View Full Code Here

            status = Status.ERROR;
        }
        }

  // Send reply
  Packet reply = new Packet(con.useDirectBuffers());
  reply.setPacketType(PacketType.OBJECT_MESSAGE);

  setProperties(reply, MessageType.UNQUIESCE_BROKER_REPLY, status, errMsg);

  parent.sendReply(con, cmd_msg, reply);
View Full Code Here

            status = Status.ERROR;
        }
        }

  // Send reply
  Packet reply = new Packet(con.useDirectBuffers());
  reply.setPacketType(PacketType.OBJECT_MESSAGE);

  setProperties(reply, MessageType.UNQUIESCE_BROKER_REPLY, status, errMsg);

  parent.sendReply(con, cmd_msg, reply);
View Full Code Here

                assert false;
            }
        }

       // Send reply
       Packet reply = new Packet(con.useDirectBuffers());
       reply.setPacketType(PacketType.OBJECT_MESSAGE);
  
       setProperties(reply, MessageType.GET_MESSAGES_REPLY,
           status, errMsg);
  
       setBodyObject(reply, v);
View Full Code Here

    public HashMap constructMessageInfo(SysMessageID sysMsgID, boolean getBody,
            HashMap destNameType)  {
        HashMap h = new HashMap();
        PacketReference  pr = getPacketReference(sysMsgID);
        Packet  pkt = pr.getPacket();
        HashMap msgHeaders = pr.getHeaders();
        Destination d = pr.getDestination();
        String corrID = pkt.getCorrelationID(), errMsg;
        int typeMask = DestType.DEST_TYPE_QUEUE;
        byte b[] = null;

        h.put("CorrelationID", corrID);

        if (corrID != null)  {
      try  {
                b = corrID.getBytes("UTF8");
      } catch(Exception e)  {
      }
        }

        h.put("CorrelationIDAsBytes", b);

        h.put("DeliveryMode", (pkt.getPersistent()) ?
      new Integer(javax.jms.DeliveryMode.PERSISTENT) :
      new Integer(javax.jms.DeliveryMode.NON_PERSISTENT));

        h.put("DestinationName", pkt.getDestination());

  if (pkt.getIsQueue())  {
            typeMask = DestType.DEST_TYPE_QUEUE;
  } else  {
            typeMask = DestType.DEST_TYPE_TOPIC;
  }

        h.put("DestinationType", new Integer(typeMask));

        h.put("Expiration", new Long(pkt.getExpiration()));

        h.put("MessageID", msgHeaders.get("JMSMessageID"));
        h.put("Priority", new Integer(pkt.getPriority()));

        h.put("Redelivered", new Boolean(pkt.getRedelivered()));

  /*
   * The ReplyTo information in the packet contains
   * the destination name and class name (i.e. dest class
   * name), which the broker cannot really use.
   * We need to query/check if:
   *  - the destination exists
   *  - what it's type is
   */
        String replyToDestName = pkt.getReplyTo();

        if (replyToDestName != null)  {
      boolean destFound = false, isQueue = true;

      if (destNameType != null)  {
    Boolean isQ = (Boolean)destNameType.get(replyToDestName);

    if (isQ != null)  {
        isQueue = isQ.booleanValue();
        destFound = true;
    }
      }

      if (!destFound)  {
          try  {
              Destination topic, queue;

              queue = Destination.findDestination(replyToDestName, true);
              topic = Destination.findDestination(replyToDestName, false);

        if ((queue != null) && (topic != null))  {
                        errMsg = "Cannot determine type of ReplyTo destination."
          + " There is a topic and queue with the name: "
          + replyToDestName;
                        logger.log(Logger.WARNING, errMsg);
        } else if (queue != null)  {
            destFound = true;
            isQueue = true;
        } else if (topic != null)  {
            destFound = true;
            isQueue = false;
        }

        if (destFound)  {
            /*
             * Cache dest name/type so that we can look it up there
             * next time.
             */
            destNameType.put(replyToDestName, new Boolean(isQueue));
        } else  {
            /*
             * It is possible that this destination no longer exists.
             * e.g. Temporary destination, whose connection has gone away.
             * Not sure how to proceed at this point.
             */
        }
          } catch (Exception e)  {
                    errMsg = "Caught exception while determining ReplyTo destination type";
                    logger.log(Logger.WARNING, errMsg, e);
          }
      }

            h.put("ReplyToDestinationName", replyToDestName);
      if (destFound)  {
    if (isQueue)  {
                    typeMask = DestType.DEST_TYPE_QUEUE;
    } else  {
                    typeMask = DestType.DEST_TYPE_TOPIC;
    }
                h.put("ReplyToDestinationType", new Integer(typeMask));
      }
        }

        h.put("Timestamp", new Long(pkt.getTimestamp()));

        h.put("Type", pkt.getMessageType());

        Hashtable msgProps;

        try  {
            msgProps = pr.getProperties();
View Full Code Here

              ((IMQBasicConnection)con).getDumpOutPacket())
              props.put("JMQReqID", msg.getSysMessageID().toString());


          // Send reply
          Packet pkt = new Packet(con.useDirectBuffers());
          pkt.setPacketType(PacketType.GENERATE_UID_REPLY);
          pkt.setConsumerID(msg.getConsumerID());
          pkt.setProperties(props);
          body.rewind();
          pkt.setMessageBody(body);

    con.sendControlMessage(pkt);

          return true;
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.io.Packet

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.