activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Almeida Goncalves <gabriel.goncal...@serpro.gov.br>
Subject Re: Need examples of Artemis for .NET core C# on AcknowledgementModes in sender and receiver
Date Mon, 03 Jun 2019 21:55:32 GMT
Ok, so if the its set o Persistent the acks are managed automatically.

Regarding to acks by the receiver and resending messages, I came to the following:

I was able to force a new delivery of a message by  closing the consumer and rollingback the
session, like :

IConnection connectionReception_1 = MyConnectionGenerator();
connectionReception_1.RedeliveryPolicy = new RedeliveryPolicy();
ISession sessionReception_1 = connectionReception_1.CreateSession(AcknowledgementMode.Transactional);
           
IMessageConsumer consumer_1 = sessionReception_1.CreateConsumer(sessionReception_1.GetQueue(nomeFila));
ITextMessage firstReceivedMessage = (ITextMessage)consumer_1.Receive(TimeSpan.FromSeconds(3));
//Below the 2 lines that make the message to be back in the queue server
consumer_1.Close();
sessionReception_1.Rollback();

-Why do I need to close the consumer to rollback the reception?
-The sessions transaction 'beginTransaction' is implicit in its instantiation?
-What is the use of the class TransactionContext if transactions are to be controller directly
in the session object?
-If I don't do a message.Acknowledge(), future sending and receiving occur normally, apparently.
If thats the way it works, why the need for the acknowledge function?
-Consider this block of code I wrote to be duplicated and expecting to receivce a second message,
but both without the two lines that make the rollbacks.
 And suppose that only one message was sent. So the first block receives one message and the
second doesn't. But if I move the two lines
that rollback the first block and put it after the second block, I expected the received message
would be back to the queue and if there was a third block
it would receive it (the same message block 1 received but rolled back ). But this is not
happening  - a third block receives no message in this setup. Why is that?

Thanks!

Gabriel Almeida Goncalves 
Analista 
Superintendência de Desenvolvimento 
Diretoria de Desenvolvimento 
(31)3311-6739

----- Mensagem original -----
De: "Timothy Bish" <tabish121@gmail.com>
Para: "users" <users@activemq.apache.org>
Enviadas: Sexta-feira, 31 de maio de 2019 19:37:44
Assunto: Re: Need examples of Artemis for .NET core C# on AcknowledgementModes in sender and
receiver

On 5/31/19 4:03 PM, Gabriel Almeida Goncalves wrote:
> How to guarantee that the server received the message, then?

The same way a JMS client does, by setting the delivery mode on the 
message producer to be persistent so that the client will wait until the 
broker acknowledges that it has taken possession of the message.


> Gabriel Almeida Goncalves
> Analista
> Superintendência de Desenvolvimento
> Diretoria de Desenvolvimento
> (31)3311-6739
>
> ----- Mensagem original -----
> De: "Justin Bertram" <jbertram@apache.org>
> Para: "users" <users@activemq.apache.org>
> Enviadas: Sexta-feira, 31 de maio de 2019 16:58:30
> Assunto: Re: Need examples of Artemis for .NET core C# on AcknowledgementModes in sender
and receiver
>
> Thanks for confirming my suspicions, Tim.
>
>
> Justin
>
> On Fri, May 31, 2019 at 2:53 PM Timothy Bish <tabish121@gmail.com> wrote:
>
>> On 5/31/19 3:44 PM, Justin Bertram wrote:
>>> I'm not terribly familiar with NMS, but in my experience the only
>> component
>>> which acknowledges a message is a consumer. How does a sender in NMS use
>>> acknowledgements?
>> It doesn't
>>> Justin
>>>
>>> On Fri, May 31, 2019 at 2:29 PM Gabriel Almeida Goncalves <
>>> gabriel.goncalves@serpro.gov.br> wrote:
>>>
>>>> Hi there.
>>>>
>>>> Can anyone please send me examples of using different
>> AcknowledgementModes
>>>> on both sender and receiver for Artemis for .NET core C# ?
>>>> I'm using the Apache.NMS.ActiveMQ.NetCore v1.7.2 Nuget Package
>>>> Let me know if my demand wasn't clear.
>>>>
>>>> Thanks in advance.
>>>>
>>>> Gabriel Almeida Goncalves
>>>> Analista
>>>> Superintendência de Desenvolvimento
>>>> Diretoria de Desenvolvimento
>>>> (31)3311-6739
>>>>
>>>> -
>>>>
>>>>
>>>> "Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO),
>>>> empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é
>>>> enviada exclusivamente a seu destinatário e pode conter informações
>>>> confidenciais, protegidas por sigilo profissional. Sua utilização
>>>> desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a
>>>> recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente,
>>>> esclarecendo o equívoco."
>>>>
>>>> "This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO)
>> -- a
>>>> government company established under Brazilian law (5.615/70) -- is
>>>> directed exclusively to its addressee and may contain confidential data,
>>>> protected under professional secrecy rules. Its unauthorized use is
>> illegal
>>>> and may subject the transgressor to the law's penalties. If you're not
>> the
>>>> addressee, please send it back, elucidating the failure."
>>>>
>> --
>> Tim Bish
>>
>>
> -
>
>
> "Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública
federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a seu destinatário
e pode conter informações confidenciais, protegidas por sigilo profissional. Sua utilização
desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a recebeu indevidamente,
queira, por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."
>
> "This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a government
company established under Brazilian law (5.615/70) -- is directed exclusively to its addressee
and may contain confidential data, protected under professional secrecy rules. Its unauthorized
use is illegal and may subject the transgressor to the law's penalties. If you're not the
addressee, please send it back, elucidating the failure."
>

-- 
Tim Bish

-


"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública federal
regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a seu destinatário
e pode conter informações confidenciais, protegidas por sigilo profissional. Sua utilização
desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a recebeu indevidamente,
queira, por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."

"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a government company
established under Brazilian law (5.615/70) -- is directed exclusively to its addressee and
may contain confidential data, protected under professional secrecy rules. Its unauthorized
use is illegal and may subject the transgressor to the law's penalties. If you're not the
addressee, please send it back, elucidating the failure."

Mime
View raw message