Package org.jboss.jms.message

Examples of org.jboss.jms.message.JBossMessage


      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
     
      long id =
         connectionState.getIdGenerator().getId((ConnectionDelegate)connectionState.getDelegate());
   
      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);
      }
      else
      {
         // get the actual message
         MessageProxy proxy = (MessageProxy)m;
                                   
         //The following line executed on the proxy should cause a copy to occur
         //if it is necessary
         proxy.setJMSMessageID(null);
        
         //Get the underlying message
         messageToSend = proxy.getMessage();    
        
         proxy.beforeSend();
      }
     
      // Set the new id
     
      messageToSend.setMessageId(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


     
      if (expiryQueue != null)
      {
         if (trace) { log.trace(this + " sending expired message to expiry queue " + expiryQueue); }
        
         JBossMessage copy = makeCopyForDLQOrExpiry(true, del);
        
         moveInTransaction(copy, del, expiryQueue);
      }
      else
      {
View Full Code Here

      {                 
         if (expired)
         {
            //Sent to expiry queue
           
            JBossMessage copy = makeCopyForDLQOrExpiry(true, del);
           
            moveInTransaction(copy, del, rec.expiryQueue);
         }
         else
         {
            //Send to DLQ
           
            JBossMessage copy = makeCopyForDLQOrExpiry(false, del);
           
            moveInTransaction(copy, del, rec.dlq);
         }
      }     
     
View Full Code Here

      //otherwise we may end up with a ref with the same message id in the queue more than once
      //which would barf - this might happen if the same message had been expire from multiple
      //subscriptions of a topic for example
      //We set headers that hold the original message destination, expiry time and original message id
     
      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(JBOSS_MESSAGING_ORIG_MESSAGE_ID, origMessageId);
     
      copy.setStringProperty(JBOSS_MESSAGING_ORIG_DESTINATION, origDest);
     
      if (expiry)
      {
         long actualExpiryTime = System.currentTimeMillis();
        
         copy.setLongProperty(JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME, actualExpiryTime);
      }
     
      return copy;
   }
View Full Code Here

            // send the messages

            for (Iterator j = sessionState.getMsgs().iterator(); j.hasNext(); )
            {
               JBossMessage message = (JBossMessage)j.next();
               if (checkForDuplicates && firstIteration)
               {
                  firstIteration = false;
                  if (serverPeer.getPersistenceManagerInstance().
                     referenceExists(message.getMessageID()))
                  {
                     // This means the transaction was previously completed...
                     // we are done here then... no need to even check for ACKs or anything else
                     log.debug("Transaction " + tx + " was previously completed, ignoring call");
                     return;
View Full Code Here

     
      os.writeInt(len);
     
      for (int i = 0; i < len; i++)
      {
         JBossMessage msg = msgs[i];
        
         os.writeByte(msg.getType());
        
         msg.write(os);
      }
     
      os.flush();
   }
View Full Code Here

     
      for (int i = 0; i < len; i++)
      {     
         byte type = is.readByte();
        
         JBossMessage msg = (JBossMessage)MessageFactory.createMessage(type);
        
         msg.read(is);
        
         msgs[i] = msg;
      }
   }
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

            Iterator iter2 = msgs.iterator();

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

               out.writeByte(m.getType());
            
               m.write(out);
            }

            List acks = state.getAcks();

            out.writeInt(acks.size());
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);
         }

         int numAcks = in.readInt();
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.