You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Timothy A. Bish (Jira)" <ji...@apache.org> on 2023/04/07 14:16:00 UTC

[jira] [Assigned] (ARTEMIS-4234) EmbeddedActiveMQResource is able to receive only first message

     [ https://issues.apache.org/jira/browse/ARTEMIS-4234?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy A. Bish reassigned ARTEMIS-4234:
----------------------------------------

    Assignee: Timothy A. Bish

> EmbeddedActiveMQResource is able to receive only first message
> --------------------------------------------------------------
>
>                 Key: ARTEMIS-4234
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4234
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.28.0
>            Reporter: Dominik Kawczyński
>            Assignee: Timothy A. Bish
>            Priority: Major
>
> Hi,
> i have encountered a problem with embedded Artemis.
> Using *EmbeddedActiveMQResource* _receiveMessage_ method im able to receive only one message from queue.
> Please look at following code:
> {code:java}
> artemis.start()
> def firstMessage = 'test message 1'
> sendMessage(firstMessage, 'test_queue')
> def firstReceivedMessage = artemis.receiveMessage('test_queue', 1000)
> println('>>>>>>>> FIRST MESSAGE:')
> println('>>>>>>>>' + firstReceivedMessage.stringBody)
> /*
> will work if artemis is restarted during test
> artemis.stop()
> artemis.start()
> */
> def secondMessage = 'test message 2'
> sendMessage(secondMessage, 'test_queue')
> def secondReceivedMessage = artemis.receiveMessage('test_queue', 1000)
> println('>>>>>>>> SECOND MESSAGE:')
> println('>>>>>>>>' + secondReceivedMessage.stringBody)
> then:
> firstMessage == firstReceivedMessage.stringBody
> secondMessage == secondReceivedMessage.stringBody {code}
> I'm getting null as secondReceivedMessage, and NPE in effect later.
>  
> The reason is (i assume) that first invocation  is creating a consumer, that is getting second message, before i invoke receiveMessage method second time (i see in logs that second message was consumed)
>  
> Is this expected behavior?
> receiveMessage is returning only one message, so my assumption was, that i can invoke it several times to retrieve consequential messages, and i have not found any documentation explaining current behavior.
>  
> I have created repo with reproducible example:
> [https://github.com/dmkaw/embedded-artemis-issue]
>  
> Thanks in advance.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)