Client/Manual acknowledgement

soniya
soniya Member Posts: 23
edited July 2022 in Connectors & Integrations #1

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

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    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?

  • soniya
    soniya Member Posts: 23

    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.

    https://codelabs.solace.dev/codelabs/spring-cloud-stream-beyond/index.html?index=..%2F..index&_ga=2.43606374.2141196047.1657525746-865749580.1650579007&_gl=1*aa4idg*_ga*ODY1NzQ5NTgwLjE2NTA1NzkwMDc.*_ga_XZ3NWMM83E*MTY1ODE1NTg4Mi4zMy4xLjE2NTgxNTkyMzEuMA..#7

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    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.

  • soniya
    soniya Member Posts: 23

    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

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    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.

  • soniya
    soniya Member Posts: 23

    Thanks@giri Its working now. I am testing it through solace portal.

    Can we do implematation in publisher end as well as like how I can send the CORRELATION_ID from producer to test the end to end flow from spring boot end application only.

  • soniya
    soniya Member Posts: 23

    @giri @marc

    I have a query related to CORRELATION_ID. How I can set the value in header for CORRELATION_ID from producer side, to test end to end flow using spring cloud application only.

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    Check out the documentation and codelab for Spring Cloud Stream - it will help.

    https://codelabs.solace.dev/codelabs/spring-cloud-stream-beyond

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    Hi @soniya - did the codelab help you?

  • soniya
    soniya Member Posts: 23

    @giri I followed the same clodelab but for end to end testing its using solace portal and in my sceniro I want to test it from spring cloud Pub/Sub only.

    So When I am trying to set CORRELATION_ID in header I am getting empty at consumer end.

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    @soniya I am sorry, I am not able to follow. Can you state in simple words what you're trying to accomplish? Is it a manual message acknowledgment or something else?

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 959 admin

    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!

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    Hi @soniya, is this still an issue? anything we can help with...