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

ASF GitHub Bot commented on JAMES-2295:
---------------------------------------

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

    https://github.com/apache/james-project/pull/127#discussion_r202240214
  
    --- Diff: 
server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
 ---
    @@ -49,7 +49,8 @@ public void setUp(BrokerService broker) throws Exception {
             RawMailQueueItemDecoratorFactory mailQueueItemDecoratorFactory = 
new RawMailQueueItemDecoratorFactory();
             NoopMetricFactory metricFactory = new NoopMetricFactory();
             String queueName = BrokerExtension.generateRandomQueueName(broker);
    -        mailQueue = new JMSMailQueue(connectionFactory, 
mailQueueItemDecoratorFactory, queueName, metricFactory);
    +        ConsumerOptions consumerOptions = name -> name + 
"?consumer.prefetchSize=0";
    --- End diff --
    
    > From my point of view our configuration/options should not affect entire 
connection to the message broker. We should be able to configure queue consumer 
creation (ConsumerOptions#applyForDequeue).
    
    I'm not arguing for changing the implementation much, just proposing to 
make the **ConsumerOptions** a dumb interface:
    
    ```
    interface ConsumerOptions {
        ImmutableMap<String, String> parameters();
    }
    ```
    
    (Not that this interface is just holding a configuration and enforce no 
knowledge about the way the queue works.)
    
    Then, We could get a JMSConsumerOptions, and an ActiveMQConsumerOptions 
with the options I can use in these various case.
    
    Then, JMSMailQueue will add the right parameters for the queue name when 
appropriate (it has the knowledge of how to encode the parameters).
    
    Thus:
     - We get strong typing for JMSConsumerOptions
     - The configuration is a dumb POJO, which is easier to reason about (and 
classic in James).
    
    Would it be OK for you?


> JMS mailqueue deadlock when a single thread issue several consume
> -----------------------------------------------------------------
>
>                 Key: JAMES-2295
>                 URL: https://issues.apache.org/jira/browse/JAMES-2295
>             Project: James Server
>          Issue Type: Bug
>          Components: Queue
>    Affects Versions: 3.0.0, master, 3.0.1
>            Reporter: Tellier Benoit
>            Priority: Major
>              Labels: bug
>
> This will lead to a dead lock:
> {code:java}
>         MailQueue.MailQueueItem mailQueueItem1 = getMailQueue().deQueue();
>         MailQueue.MailQueueItem mailQueueItem2 = getMailQueue().deQueue();
>         mailQueueItem1.done(true);
>         mailQueueItem2.done(true);
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to