[ 
https://issues.apache.org/jira/browse/AMQ-4476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13808960#comment-13808960
 ] 

Andrzej Więcław commented on AMQ-4476:
--------------------------------------

No, in fact I'm using AMQ as custom JMS provider.
I believe it could have something to do with DLQ concept.
Doesn't it work this way that rejected messages are moved to DLQ's? 
Could that behavior be modified so rejected message is rolled back to the 
original queue (instead of DLQ) and therefore stops processing of other 
awaiting messages?

> ActiveMQ WebSphere 7 JMS Provider - MBD - message consumed even though 
> transaction marked for rollback
> ------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-4476
>                 URL: https://issues.apache.org/jira/browse/AMQ-4476
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JMS client
>    Affects Versions: 5.6.0, 5.7.0, 5.8.0
>         Environment: Windows Server 2008 R2
>            Reporter: Andrzej Więcław
>
> I have an EAR that is deployed to Websphere 7.
> It includes EJB module containing a couple of MDBs that are listening on 
> Message Listener Port, pointing to connection factory and queue exposed by 
> custom ActiveMQ JMS Provider.
> ActiveMQ JMS Provider configuration script (JACL):
> {code}
> import sys
> jmsProviderUrl = "tcp://x.x.x.x:61616"    
> # Retrieve cell name
> cell = AdminControl.getCell()
> scope = "Cell=" + cell
> jmsProviderName = "ActiveMQ"
> node = sys.argv[0]
> server = sys.argv[1]
> # ----------------
> # Add JMS Provider
> # ----------------
> attributes = [["description", "ActiveMQ JMS Provider"], \
>               ["propertySet", [["resourceProperties", [ \
>                                                        [["name", 
> "java.naming.connectionFactoryNames"], ["type", "java.lang.String"], 
> ["value", "ConnectionFactory,XAConnectionFactory"]], \
>                                                        [["name", 
> "java.naming.queue.MXITEMIN"], ["type", "java.lang.String"], ["value", 
> "MX.ITEM.IN"]] \
>                                                        ] \
>                                 ]] \
>                ]]
> AdminJMS.createJMSProviderAtScope(scope, jmsProviderName, \
>                                   
> "org.apache.activemq.jndi.ActiveMQWASInitialContextFactory", \
>                                   jmsProviderUrl, attributes)
> # ----------------------
> # Add Connection Factory
> # ----------------------
> attributes = [["description", "ActiveMQ Queue Connection Factory"], \
>               ["type", "UNIFIED"], \
>               ["connectionPool", [ \
>                                   ["connectionTimeout", "1800"], \
>                                   ["maxConnections", "6"], \
>                                   ["minConnections", "0"], \
>                                   ["reapTime", "180"], \
>                                   ["unusedTimeout", "1800"], \
>                                   ["agedTimeout", "1800"], \
>                                   ["purgePolicy", "EntirePool"] \
>                                   ] \
>                ], \
>               ["sessionPool", [ \
>                                   ["connectionTimeout", "1800"], \
>                                   ["maxConnections", "1"], \
>                                   ["minConnections", "0"], \
>                                   ["reapTime", "10"], \
>                                   ["unusedTimeout", "1800"], \
>                                   ["agedTimeout", "1800"], \
>                                   ["purgePolicy", "EntirePool"] \
>                                   ] \
>             ]]
> AdminJMS.createGenericJMSConnectionFactoryAtScope(scope, jmsProviderName, 
> "ACTIVEMQCF", \
>                                                   "if/maximo/activemq/cf", 
> "XAConnectionFactory", \
>                                                   attributes)
> # ----------------------
> # Add Queues
> # ----------------------
> # 1. MX.ASSET.IN
> attributes = [["description", "ActiveMQ ASSET Queue"], ["type", "QUEUE"]]
> AdminJMS.createGenericJMSDestinationAtScope(scope, jmsProviderName, 
> "MAXIMO04IN", \
>                                             "if/maximo/activemq/q04cin", 
> "MXASSETIN", \
>                                             attributes) 
> # ---------------------------------------
> # Create IF-server Message Listener Ports 
> # ---------------------------------------
> # PORTMAXIMO01IN
> attributes = [["description", "ActiveMQ Item"]]
> AdminServerManagement.configureListenerPortForMessageListenerService(node, 
> server, "PORTMAXIMO01IN", \
>                                                                      
> "if/maximo/activemq/cf", \
>                                                                      
> "if/maximo/activemq/q01cin", \
>                                                                      1, 5, 1, 
> attributes)
> {code}
> MDB code:
> {code}
> public class MQQueueListener implements MessageListener, MessageDrivenBean {
>       
>     protected MessageDrivenContext beanCtx;
>     public void setMessageDrivenContext(MessageDrivenContext ctx)
>             throws EJBException {
>         // Set the bean context.
>         beanCtx = ctx;
>     }
>     public void ejbCreate() throws EJBException {
>         [...]
>     }
>     public void ejbRemove() throws EJBException {
>         [...]
>     }
>     public void onMessage(Message message) {
>         [...]
>         try {
>             [...]
>         } catch (Exception e) {
>             // Rollback message to external queue.
>             beanCtx.setRollbackOnly();
>         }
>     }
> }
> {code}
> When something goes wrong with the message processing and Exception is thrown 
> regardless if beanCtx.setRollbackOnly(); is executed or not message is not 
> returned back to the queue - it simply disappears. 
> The same applies if Exception is re-thrown as RuntimeException instead of 
> beanCtx.setRollbackOnly() call.
> ------------------
> Expected behavior:
> ------------------
> Message that could not be processed is returned to the ActiveMQ queue and 
> available for reprocessing (according to WebSphere reprocessing policy)



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to