🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

JCSMP Ack mode

slsbel
slsbel Member Posts: 13
edited November 2022 in General Discussions #1

Hello.

I'm creating a Jcsmp session based on this tutorial: solace-samples-java-jcsmp/QueueConsumer.java at master · SolaceSamples/solace-samples-java-jcsmp · GitHub.

even if I'm setting the flow_prop.setAckMode(JCSMPProperties.SUPPORTED_MESSAGE_ACK_CLIENT);

and passing the flow_prop to the session as in the tutorial.

the generated message session ack mode is : messageAckMode ="auto_ack"



is anything missing in the configuration of the session?

Thank you!

Tagged:

Comments

  • slsbel
    slsbel Member Posts: 13
    edited November 2022 #2

    I think I know what is causing this issue!

    The session is created based on SpringJCSMPFactory, and SolaceJavaAutoConfiguration Bean.

    as follow:

    solaceFactory = solaceJavaAutoConfiguration.getSpringJCSMPFactory();
    session = solaceFactory.createSession();
    

    That is giving me access to the broker and the queue based on the Spring boot application properties

    solace.java.clientPassword=password
    solace.java.clientUsername=username
    solace.java.host=tcps://mybroker:55443
    solace.java.msgVpn=default
    

    How I can pass other properties to the session if it is created based on SpringBoot JCSMP Factory? since the SpringJCSMPFactory createSession() method doesn't accept JCSMPProperties as parameter?

  • slsbel
    slsbel Member Posts: 13
    edited November 2022 #3

    I was able to resolve this issue by getting the JCSMPProperties from the SolaceJavaAutoConfiguration Bean (to access the properties from the application.properties file) as follows:

    JCSMPProperties jcsmpProperties = solaceJavaAutoConfiguration.getJCSMPProperties();
    

    and setting the acknowledgment using the property setter:

    jcsmpProperties.setProperty(JCSMPProperties.MESSAGE_ACK_MODE,JCSMPProperties.SUPPORTED_MESSAGE_ACK_CLIENT);
    

    and finally, I'm creating the session using the JCSMPFactory instead of the SpringJCSMPFactory , and passing the properties.

    session = JCSMPFactory.onlyInstance().createSession(jcsmpProperties);
    

    I'm not sure if there is a way to achieve the same configuration using SpringJCSMPFactory?