cancel
Showing results for 
Search instead for 
Did you mean: 

JMS Connection Limit

Former Member
0 Kudos

Hi,

I have an MDB which, on receipt of a message, generates more messages and posts them out to another queue.

However, I am finding that I am reaching a JMS Connection limit (very quickly), which results in the locking of the jms framework, as it waits for 60 seconds to try and get a new connection.

I am using the Spring Framework JmsTemplate to do the sending. It is created once, and the .send method is called multiple times.

I am aware of the jms settings in the admin tool, which are currently set to 100 for number of connections and 60 for connection delay.

I have 2 questions:

1) Is SAP Netweaver not pooling the jms connections correctly from a ConnectionFactory?

2) What is the recommended value for the jms connection limit?

Thanks.

Andrew

Accepted Solutions (0)

Answers (1)

Answers (1)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Andrew

I have a question why do you need to open so many connections. Do you send the generated messages to several remote systems? I suppose that in onMessage(...) if you should open connection, send all the generated messages and then close the connection.

You can also use a @PostConstruct callback method to create the connection, and a @PreDestroy callback method to close the connection.

BR, Sergei

Former Member
0 Kudos

Sergei,

I dont need that many connections. I only need one.

However, the SAP jms connection seems to go up everytime i send a message. ie it is not returning the same connection for use from the connection pool!

The jmsTemplate (or sender) only is created once and then told to send several messages, but instead the connections go up with the number of messages...

Andrew

siarhei_pisarenka3
Active Contributor
0 Kudos

Maybe the problem is in the Spring JMS Template... Why do you need it? Can you replace it with native JMS API and send the messages with the API? This will allow you to control explicitly open/close connection operations.

BR, Sergei

Former Member
0 Kudos

Hi Sergei.

We use this class to send jms messages, as it allows a lot of other features that the native api does not have.

It just seems odd that all the connections are being used up...

I have a feeling though that the same thing would happen with all the native api calls.

This is all running on CE 7.1 SP6.

Regards,

Andrew

Former Member
0 Kudos

I have replaced the jms calls with native ones, and the problem persists.

Its not to do with the connection though - it closes the session once the initial message has been sent, hence requiring a new connection everytime....

Why would Netweaver do that?

Regards,

Andrew

siarhei_pisarenka3
Active Contributor
0 Kudos

Could you please, post the snippet where you are sending the messages and point the place where a new connection is apparently created?

BR, Sergei

Former Member
0 Kudos

Sergei,

This code is called from the onMessage method: It will cause the problem.


private ConnectionFactory m_cf;
	private Destination m_dest;

	private final Log m_logger = LogFactory.getLog(getClass());
	private Destination dest;
	private JmsTemplate m_jt;

	SimpleMessageDispatcher()
	{
		
	}
	
		
	@SuppressWarnings("unchecked")
	public void dispatch(Message message)
	{
		try
		{
		Connection c = m_cf.createConnection();
		Session s = c.createSession(true, Session.AUTO_ACKNOWLEDGE);
	
		MessageProducer p = s.createProducer(m_dest);
		
		
		for (int i=0; i< 200; i++)
		{
			
			m_logger.info("Dispatching message:[" +i + "] to:[" + m_dest + "]");
			try
			{
				
				sendJmsMessage(""+i,c,s,p);
			}
			catch (JMSException e)
			{
				// TODO Auto-generated catch block
				m_logger.error("Error!!!",e);
			}
		}
		}
		catch(Exception e)
		{
			m_logger.error("Error in getting stuff....",e);
		}
	}