# Acknowledging messages using Spring JMS

**URL:** <https://community.solace.com/t/acknowledging-messages-using-spring-jms/377>\
**Category:** General Discussions\
**Tags:** spring, jms\
**Created:** [August 25, 2020, 5:54am UTC](https://community.solace.com/t/acknowledging-messages-using-spring-jms/377 "2020-08-25T05:54:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asx19](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@asx19](https://community.solace.com/u/asx19)\
**Post date:** [August 25, 2020, 5:54am UTC](https://community.solace.com/t/acknowledging-messages-using-spring-jms/377/1 "2020-08-25T05:54:54Z")

</div>

Hello,  
I would like to manually acknowledge each message I receive from the Solace queue using the JMS protocol. However with the configuration I have below, I am seeing that the messages are actually not being removed even after I explicitly call “message.acknowledge()” on the message.

```auto
@Bean()
    public DefaultJmsListenerContainerFactory connectionFactory(SolConnectionFactory solConnectionFactory, SolaceErrorHandler errorHandler) {
        DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
        factory.setConnectionFactory(solConnectionFactory);
        factory.setErrorHandler(errorHandler);
        factory.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
        return factory;
    }

```

I couldn’t really find much documentation on manually ack-ing each message in the application. Should I be changing something here?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [August 25, 2020, 5:47pm UTC](https://community.solace.com/t/acknowledging-messages-using-spring-jms/377/2 "2020-08-25T17:47:49Z")

</div>

Hi @asx19 ,  
Are you using the `@JmsListener` annotation on the receiving method?  
If yes, can you try adding a name of “jmsListenerContainerFactory” to your `DefaultJmsListenerContainerFactory` bean and seeing if that works for you?

```auto
	@Bean(name = "jmsListenerContainerFactory")
	public DefaultJmsListenerContainerFactory connectionFactory(SolConnectionFactory solConnectionFactory) {
		DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
		factory.setConnectionFactory(solConnectionFactory);
		factory.setErrorHandler(errorHandler);
		factory.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
		return factory;
	}

```

Once you get it working another thing to look into is whether you want to use the JMS default [Session.CLIENT\_ACKNOWLEDGE](https://docs.oracle.com/javaee/7/api/javax/jms/Session.html#CLIENT_ACKNOWLEDGE) or if you want to use [SupportedProperty.SOL\_CLIENT\_ACKNOWLEDGE](https://docs.solace.com/API-Developer-Online-Ref-Documentation/jms/com/solacesystems/jms/SupportedProperty.html#SOL_CLIENT_ACKNOWLEDGE)

Hope that helps!  
-Marc

---

<div class="post-metadata">

**Author:** ![asx19](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@asx19](https://community.solace.com/u/asx19)\
**Post date:** [August 25, 2020, 8:04pm UTC](https://community.solace.com/t/acknowledging-messages-using-spring-jms/377/3 "2020-08-25T20:04:10Z")

</div>

Hi @marc,  
Thanks-- using `SupportedProperty.SOL_CLIENT_ACKNOWLEDGE` indeed solved the problem.

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [August 25, 2020, 9:16pm UTC](https://community.solace.com/t/acknowledging-messages-using-spring-jms/377/4 "2020-08-25T21:16:12Z")

</div>

> [@asx19](#):
>
> Hi @marc,  
> Thanks-- using `SupportedProperty.SOL_CLIENT_ACKNOWLEDGE` indeed solved the problem.

Awesome, glad I could help!
