Package org.jboss.jms.message

Examples of org.jboss.jms.message.JBossMessage


      if (expiryQueue != null)
      {
         if (trace) { log.trace(this + " sending expired message to expiry queue " + expiryQueue); }

         JBossMessage copy = makeCopyForDLQOrExpiry(true, del);

         moveInTransaction(copy, del, expiryQueue, true);
      }
      else
      {
View Full Code Here


      {
         if (expired)
         {
            //Sent to expiry queue

            JBossMessage copy = makeCopyForDLQOrExpiry(true, del);

            moveInTransaction(copy, del, rec.expiryQueue, false);
         }
         else
         {
            //Send to DLQ

            JBossMessage copy = makeCopyForDLQOrExpiry(false, del);

            moveInTransaction(copy, del, rec.dlq, true);
         }
      }
View Full Code Here

      //subscriptions of a topic for example
      //We set headers that hold the original message destination, expiry time and original message id

     if (trace) { log.trace("Making copy of message for DLQ or expiry " + del); }

      JBossMessage msg = ((JBossMessage)del.getReference().getMessage());

      JBossMessage copy = msg.doCopy();

      long newMessageId = sp.getMessageIDManager().getID();

      copy.setMessageId(newMessageId);

      //reset expiry
      copy.setExpiration(0);

      String origMessageId = msg.getJMSMessageID();

      String origDest = msg.getJMSDestination().toString();

      copy.setStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID, origMessageId);

      copy.setStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION, origDest);

      if (expiry)
      {
         long actualExpiryTime = System.currentTimeMillis();

         copy.setLongProperty(JBossMessage.JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME, actualExpiryTime);
      }

      return copy;
   }
View Full Code Here

            Iterator iter2 = msgs.iterator();

            while (iter2.hasNext())
            {
               JBossMessage m = (JBossMessage) iter2.next();

               out.writeByte(m.getType());

               m.write(out);
            }

            List acks = state.getAcks();

            iter2 = acks.iterator();
View Full Code Here

         for (int j = 0; j < numMsgs; j++)
         {
            byte type = in.readByte();

            JBossMessage msg = (JBossMessage) MessageFactory.createMessage(type);

            msg.read(in);

            sessionState.addMessage(msg);
         }

         long l;
View Full Code Here

      SessionState sessionState = (SessionState)producerState.getParent();

      // Generate the message id
      ConnectionState connectionState = (ConnectionState)sessionState.getParent();

      JBossMessage messageToSend;
      boolean foreign = false;

      if (!(m instanceof MessageProxy))
      {
         // it's a foreign message

         foreign = true;

         // JMS 1.1 Sect. 3.11.4: A provider must be prepared to accept, from a client,
         // a message whose implementation is not one of its own.

         // create a matching JBossMessage Type from JMS Type
         if(m instanceof BytesMessage)
         {
            messageToSend = new JBossBytesMessage((BytesMessage)m,0);
         }
         else if(m instanceof MapMessage)
         {
            messageToSend = new JBossMapMessage((MapMessage)m,0);
         }
         else if(m instanceof ObjectMessage)
         {
            messageToSend = new JBossObjectMessage((ObjectMessage)m,0);
         }
         else if(m instanceof StreamMessage)
         {
            messageToSend = new JBossStreamMessage((StreamMessage)m,0);
         }
         else if(m instanceof TextMessage)
         {
            messageToSend = new JBossTextMessage((TextMessage)m,0);
         }
         else
         {
            messageToSend = new JBossMessage(m, 0);
         }

         messageToSend.setJMSMessageID(null);

         //We must set the destination *after* converting from foreign message
         messageToSend.setJMSDestination(destination);
         if(connectionState.getRemotingConnection().isStrictTck())
         {
            m.setJMSDestination(destination);
         }
      }
      else
      {
         // get the actual message
         MessageProxy proxy = (MessageProxy)m;

         m.setJMSDestination(destination);
        
         //Get the underlying message
         messageToSend = proxy.getMessage();

         proxy.beforeSend();
      }

      // Set the new id

      if (!keepID)
      {
         String id = "ID:JBM-" + UUID.randomUUID().toString();
        
         messageToSend.setJMSMessageID(id);
      }
     
      // This only really used for BytesMessages and StreamMessages to reset their state
      messageToSend.doBeforeSend();
     
      // now that we know the messageID, set it also on the foreign message, if is the case
      if (foreign)
      {
         m.setJMSMessageID(messageToSend.getJMSMessageID());
      }
           
      // we now invoke the send(Message) method on the session, which will eventually be fielded
      // by connection endpoint
      ((SessionDelegate)sessionState.getDelegate()).send(messageToSend, false);
View Full Code Here

         // send the messages

         for (Iterator j = sessionState.getMsgs().iterator(); j.hasNext(); )
         {
            JBossMessage message = (JBossMessage)j.next();

            if (checkForDuplicates && !message.isReliable())
            {
               //Ignore np messages on failover
            }
            else
            {
View Full Code Here

      SessionState sessionState = (SessionState)producerState.getParent();

      // Generate the message id
      ConnectionState connectionState = (ConnectionState)sessionState.getParent();

      JBossMessage messageToSend;
      boolean foreign = false;

      if (!(m instanceof MessageProxy))
      {
         // it's a foreign message

         foreign = true;

         // JMS 1.1 Sect. 3.11.4: A provider must be prepared to accept, from a client,
         // a message whose implementation is not one of its own.

         // create a matching JBossMessage Type from JMS Type
         if(m instanceof BytesMessage)
         {
            messageToSend = new JBossBytesMessage((BytesMessage)m,0);
         }
         else if(m instanceof MapMessage)
         {
            messageToSend = new JBossMapMessage((MapMessage)m,0);
         }
         else if(m instanceof ObjectMessage)
         {
            messageToSend = new JBossObjectMessage((ObjectMessage)m,0);
         }
         else if(m instanceof StreamMessage)
         {
            messageToSend = new JBossStreamMessage((StreamMessage)m,0);
         }
         else if(m instanceof TextMessage)
         {
            messageToSend = new JBossTextMessage((TextMessage)m,0);
         }
         else
         {
            messageToSend = new JBossMessage(m, 0);
         }

         messageToSend.setJMSMessageID(null);

         //We must set the destination *after* converting from foreign message
         messageToSend.setJMSDestination(destination);
         if(connectionState.getRemotingConnection().isStrictTck())
         {
            m.setJMSDestination(destination);
         }
      }
      else
      {
         // get the actual message
         MessageProxy proxy = (MessageProxy)m;

         m.setJMSDestination(destination);
        
         //Get the underlying message
         messageToSend = proxy.getMessage();

         proxy.beforeSend();
      }

      // Set the new id

      if (!keepID)
      {
         String id = "ID:JBM-" + UUID.randomUUID().toString();
        
         messageToSend.setJMSMessageID(id);
      }
     
      // This only really used for BytesMessages and StreamMessages to reset their state
      messageToSend.doBeforeSend();
     
      // now that we know the messageID, set it also on the foreign message, if is the case
      if (foreign)
      {
         m.setJMSMessageID(messageToSend.getJMSMessageID());
      }
           
      // we now invoke the send(Message) method on the session, which will eventually be fielded
      // by connection endpoint
      ((SessionDelegate)sessionState.getDelegate()).send(messageToSend, false);
View Full Code Here

      return new Integer(getState(invocation).getAcknowledgeMode());
   }
  
   public Object handleCreateMessage(Invocation invocation) throws Throwable
   {
      JBossMessage jbm = new JBossMessage(0);
      
      return new MessageProxy(jbm);
   }
View Full Code Here

   {
      Message m = null;
     
      if (type == JBossMessage.TYPE) //1
      {
         m = new JBossMessage();
      }
      else if (type == JBossObjectMessage.TYPE) //2
      {
         m = new JBossObjectMessage();
      }
View Full Code Here

TOP

Related Classes of org.jboss.jms.message.JBossMessage

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.