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

ASF GitHub Bot commented on NIFI-3983:
--------------------------------------

Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1863#discussion_r124466131
  
    --- Diff: 
nifi-nar-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java
 ---
    @@ -71,10 +71,27 @@ public Void doInJms(Session session) throws 
JMSException {
                      * delivery and restarts with the oldest unacknowledged 
message
                      */
                     session.recover();
    +                boolean isPubSub = 
JMSConsumer.this.jmsTemplate.isPubSubDomain();
                     Destination destination = 
JMSConsumer.this.jmsTemplate.getDestinationResolver().resolveDestinationName(
    -                        session, destinationName, 
JMSConsumer.this.jmsTemplate.isPubSubDomain());
    -                MessageConsumer msgConsumer = 
session.createConsumer(destination, null,
    -                        JMSConsumer.this.jmsTemplate.isPubSubDomain());
    +                        session, destinationName, isPubSub);
    +                MessageConsumer msgConsumer;
    +                if (isPubSub) {
    +                    if (shared) {
    --- End diff --
    
    When I tested shared consumer with ActiveMQ 5, I got following error as it 
only supports JMS 1.1:
    
    ```
    2017-06-28 15:56:02,325 WARN [Timer-Driven Process Thread-4] 
o.a.n.c.t.ContinuallyRunProcessorTask java.lang.AbstractMethodError: 
org.apache.activemq.ActiveMQSession.createSharedConsumer(Ljavax/jms/Topic;Ljava/lang/String;Ljava/lang/String;)Ljavax/jms/MessageConsumer;
            at sun.reflect.GeneratedMethodAccessor781.invoke(Unknown Source)
            at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at 
org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.getCachedConsumer(CachingConnectionFactory.java:428)
            at 
org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:366)
            at com.sun.proxy.$Proxy123.createSharedConsumer(Unknown Source)
            at 
org.apache.nifi.jms.processors.JMSConsumer$1.doInJms(JMSConsumer.java:83)
            at 
org.apache.nifi.jms.processors.JMSConsumer$1.doInJms(JMSConsumer.java:65)
            at 
org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:494)
            at 
org.apache.nifi.jms.processors.JMSConsumer.consume(JMSConsumer.java:65)
            at 
org.apache.nifi.jms.processors.ConsumeJMS.rendezvousWithJms(ConsumeJMS.java:156)
            at 
org.apache.nifi.jms.processors.AbstractJMSProcessor.onTrigger(AbstractJMSProcessor.java:147)
            at 
org.apache.nifi.jms.processors.ConsumeJMS.onTrigger(ConsumeJMS.java:58)
            at 
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
            at 
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1120)
    ```
    
    Can we make the error message more user friendly like this:
    
    ```
                        if (shared) {
                            try {
                                if (durable) {
                                    msgConsumer = 
session.createSharedDurableConsumer((Topic)destination, subscriberName);
                                } else {
                                    msgConsumer = 
session.createSharedConsumer((Topic)destination, subscriberName);
                                }
                            } catch (AbstractMethodError e) {
                                throw new ProcessException("Failed to create a 
shared consumer. Make sure the target broker is JMS 2.0 compliant.", e);
                            }
                        } else {
    ```


> Support ability to make JMS 2.0 durable subscriptions on Topic
> --------------------------------------------------------------
>
>                 Key: NIFI-3983
>                 URL: https://issues.apache.org/jira/browse/NIFI-3983
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Michael Andre Pearce
>
> Currently the jms consumer, only supports standard queue consumption and 
> topic subscription. For topics, in JMS 2.0 you can make shared durable 
> subscribers which gives a subscription semantic similar to queue per 
> subscription name, meaning message is delivered once per subscription. This 
> is very useful in setups using JMS 2.0.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to