[jboss-cvs] JBoss Messaging SVN: r3082 - in trunk/src: main/org/jboss/jms/client/container and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 31 11:47:06 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-08-31 11:47:06 -0400 (Fri, 31 Aug 2007)
New Revision: 3082

Modified:
   trunk/src/etc/aop-messaging-client.xml
   trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java
   trunk/src/main/org/jboss/jms/delegate/ProducerDelegate.java
   trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/MessageSucker.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-1063 - fix

Modified: trunk/src/etc/aop-messaging-client.xml
===================================================================
--- trunk/src/etc/aop-messaging-client.xml	2007-08-31 14:22:05 UTC (rev 3081)
+++ trunk/src/etc/aop-messaging-client.xml	2007-08-31 15:47:06 UTC (rev 3082)
@@ -233,7 +233,7 @@
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientProducerDelegate->getTimeToLive())">
       <advice name="handleGetTimeToLive" aspect="org.jboss.jms.client.container.ProducerAspect"/>         
    </bind>   
-   <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientProducerDelegate->send(org.jboss.jms.destination.JBossDestination, javax.jms.Message, int, int, long))">
+   <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientProducerDelegate->send(..))">
       <advice name="handleSend" aspect="org.jboss.jms.client.container.ProducerAspect"/>         
    </bind>   
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientProducerDelegate->setDeliveryMode(..))">

Modified: trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java	2007-08-31 14:22:05 UTC (rev 3081)
+++ trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java	2007-08-31 15:47:06 UTC (rev 3082)
@@ -87,6 +87,8 @@
       int priority = ((Integer)args[3]).intValue();
       long timeToLive = ((Long)args[4]).longValue();
 
+      boolean keepID = args.length>5? ((Boolean)args[5]).booleanValue() : false;
+
       // configure the message for sending, using attributes stored as metadata
 
       ProducerState producerState = getProducerState(mi);
@@ -165,16 +167,15 @@
       // Generate the message id
       ConnectionState connectionState = (ConnectionState)sessionState.getParent();
       
-      long id =
-         connectionState.getIdGenerator().getId((ConnectionDelegate)connectionState.getDelegate());
-    
+      long id = 0;
+
       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,
@@ -215,6 +216,12 @@
       {
          // get the actual message
          MessageProxy proxy = (MessageProxy)m;
+
+         if (keepID)
+         {
+            id = ((MessageProxy)m).getMessage().getMessageID();
+         }
+
          
          m.setJMSDestination(destination);
                                     
@@ -230,6 +237,11 @@
           
       // Set the new id
       
+      if (!keepID && id == 0l)
+      {
+         id = connectionState.getIdGenerator().getId((ConnectionDelegate)connectionState.getDelegate());
+      }
+
       messageToSend.setMessageId(id);
       
       // This only really used for BytesMessages and StreamMessages to reset their state

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java	2007-08-31 14:22:05 UTC (rev 3081)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java	2007-08-31 15:47:06 UTC (rev 3082)
@@ -148,7 +148,13 @@
    {
       throw new IllegalStateException("This invocation should not be handled here!");
    }
-   
+
+
+   public void send(JBossDestination destination, Message message, int deliveryMode, int priority, long timeToLive, boolean keepOriginalID) throws JMSException
+   {
+      throw new IllegalStateException("This invocation should not be handled here!");
+   }
+
    /**
     * This invocation should either be handled by the client-side interceptor chain or by the
     * server-side endpoint.

Modified: trunk/src/main/org/jboss/jms/delegate/ProducerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/delegate/ProducerDelegate.java	2007-08-31 14:22:05 UTC (rev 3081)
+++ trunk/src/main/org/jboss/jms/delegate/ProducerDelegate.java	2007-08-31 15:47:06 UTC (rev 3082)
@@ -69,4 +69,10 @@
              int deliveryMode,
              int priority,
              long timeToLive) throws JMSException;
+
+   void send(JBossDestination destination,
+             Message message,
+             int deliveryMode,
+             int priority,
+             long timeToLive, boolean keepOriginalID) throws JMSException;
 }

Modified: trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/MessageSucker.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/MessageSucker.java	2007-08-31 14:22:05 UTC (rev 3081)
+++ trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/MessageSucker.java	2007-08-31 15:47:06 UTC (rev 3082)
@@ -279,7 +279,7 @@
 				}
 			}
 			
-			producer.send(null, msg, msg.getJMSDeliveryMode(), msg.getJMSPriority(), timeToLive);
+			producer.send(null, msg, msg.getJMSDeliveryMode(), msg.getJMSPriority(), timeToLive, true);
 			
 			if (trace) { log.trace(this + " forwarded message to queue"); }
 




More information about the jboss-cvs-commits mailing list