Client/Manual acknowledgement
Hi @marc
I am tring to do Client/Manual acknowledgement using spring cloud. First I want to know what configuration I have to do for producer end bcz I did the configuration on consumer side and its getting failed as shown below logs. I have attached java code and yaml file as well please suggest.
cid------>: null
2022-07-19 11:36:15.427 INFO 1400 --- [pool-4-thread-1] com.Application : Rejecting the Message
2022-07-19 11:36:15.428 INFO 1400 --- [pool-4-thread-1] backFactory$JCSMPAcknowledgementCallback : Cannot REQUEUE XMLMessage 1845175 since this flow is bound to a temporary queue, failed message will be discarded.
Comments
-
Hi @soniya,
To your question about configuration on the publisher side for manual ack - There is no specific configuration you need on the producer side.
It is not clear how your code ends up in issuing a requeue acknowledgment, which is the only scenario that can throw the exception you see.
Few observations on your configuration:
a) Code is throwing a RunTimeExceptin irrespective of the ack processing - this will treat the message as rejected and to be re-delivered. On successful execution, you may just want to return and not throw an exception.
b) You are using a non-durable endpoint - SupplyOrderEventTypeNetwork1ConsumerE1 that does not have any group specified and has a single consumer (default), and a requeue acknowledgment is not possible on temporary queues.
Can you provide more info on what you are trying/verifying?
0 -
Hi @giri
Thanks For your suggestion.
I have changed the non durable queue to durable que and I am doing it for 1 consumer only. I am following this codelab, I can be worng. Currently correlation Id is null so res
t of the condition is not working.
0 -
Hi @soniya, Are you still getting an error - when cid is null, it defaults the value to "none", which would have been handled by the last else block in the if-else-if code, i.e, treated as 'reject'.
I just followed the codelab, ran this code, and for sure see the message getting rejected and due to redelivery attempt was made 3-times and finally discarded. You can also verify this in the queue stats - queued: 1, messages redelivered: 2, and discarded due to max redeliveries: 1
What do you see, maybe just share the console log output - that will help.
0 -
Hi @giri Now I am getting none, but I need solace_correlationId .
currently , Its coing in catch exception. (SolaceAcknowledgmentException | InterruptedException e)
Logs are below.
2022-07-22 18:41:23.230 INFO 13188 --- [pool-4-thread-1] com..Application : Received: {"eventType":"SAPONEUS","network":"Verizon"}
2022-07-22 18:41:23.230 INFO 13188 --- [pool-4-thread-1] com..Application : cid: {"eventType":"SAPONEUS","network":"Verizon"}
2022-07-22 18:41:23.231 INFO 13188 --- [pool-4-thread-1] com..Application : Rejecting the Message
2022-07-22 18:41:23.231 INFO 13188 --- [pool-4-thread-1] backFactory$JCSMPAcknowledgementCallback : XMLMessage 1: Will be re-queued onto queue scst/wk/nonexclusive/plain/Supply/Order/Create/SAPONEUS/Verizon
2022-07-22 18:41:23.231 INFO 13188 --- [pool-4-thread-1] c.s.s.c.s.b.util.FlowReceiverContainer : Rebinding flow receiver container 70c7d42b-4756-4c10-9358-5b5188ca3775
2022-07-22 18:41:23.232 INFO 13188 --- [pool-4-thread-1] c.s.s.c.s.b.util.FlowReceiverContainer : Stopping flow receiver container 70c7d42b-4756-4c10-9358-5b5188ca3775
2022-07-22 18:41:23.233 INFO 13188 --- [pool-4-thread-1] c.s.s.c.s.b.util.UnsignedCounterBarrier : Waiting for 0 items, time remaining: 10000 MILLISECONDS
2022-07-22 18:41:23.234 INFO 13188 --- [pool-4-thread-1] c.s.s.c.s.b.util.FlowReceiverContainer : Unbinding flow receiver container 70c7d42b-4756-4c10-9358-5b5188ca3775
2022-07-22 18:41:23.363 INFO 13188 --- [pool-4-thread-1] c.s.s.c.s.b.util.FlowReceiverContainer : Binding flow receiver container 70c7d42b-4756-4c10-9358-5b5188ca3775
0 -
Hi @soniya, You are printing the wrong value for
cid
- cid is coming correctly with whatever value you set while publishing.It must have been null, so it goes into REJECT and retry loop. Fix the print statement and see what cid is carrying.
0 -
Check out the documentation and codelab for Spring Cloud Stream - it will help.
https://codelabs.solace.dev/codelabs/spring-cloud-stream-beyond
0 -
Hi @soniya,
Were you able to figure it out? A list of Solace message properties, including the solace correlation id can be found in this table in the docs: https://github.com/SolaceProducts/solace-spring-cloud/tree/master/solace-spring-cloud-starters/solace-spring-cloud-stream-starter#solace-headers
By using those headers on the message within Spring the binder will properly set the message property on the Solace SMF message that goes over the broker and your consumer should be able to read it out.
Hope that helps!
0