Set consumer cache size in com.swiftmq.jms.springsupport.SingleSharedConnectionFactory

View: New views
2 Messages — Rating Filter:   Alert me  

Set consumer cache size in com.swiftmq.jms.springsupport.SingleSharedConnectionFactory

by jchang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm using com.swiftmq.jms.springsupport.SingleSharedConnectionFactory.  How do I set the consumer cache size?  Sorry if the answer is already in the forum; I looked for it and did not find it.  Thanks.
-john

Re: Set consumer cache size in com.swiftmq.jms.springsupport.SingleSharedConnectionFactory

by IIT Software :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Since SingleSharedConnectionFactory is only a wrapper around a target connection factory, you need to configure the target connection factory's consumer cache size.  For example, if you spring config is like this:

    <bean id="jmsConnectionFactory"
          class="org.springframework.jndi.JndiObjectFactoryBean"
          lazy-init="true">
      <property name="jndiTemplate">
        <ref bean="jndiTemplate"/>
      </property>
      <property name="jndiName">
        <value>plainsocket@router1</value>
      </property>
    </bean>

    <bean id ="singleSharedConnectionFactory"
          class="com.swiftmq.jms.springsupport.SingleSharedConnectionFactory"
          destroy-method="destroy" >
      <property name="targetConnectionFactory" ref="jmsConnectionFactory"/>
      <property name="poolExpiration" value="120000"/>
      <property name="clientId" value="test"/>
    </bean>

then you use "plainsocket@router1" as your target connection factory and can configure it appropriately in your routerconfig.xml:

      <listener name="plainsocket" port="4001">
        <connection-factories>
          <connection-factory name="ConnectionFactory"/>
          <connection-factory name="QueueConnectionFactory"/>
          <connection-factory name="TopicConnectionFactory"/>
          <connection-factory name="plainsocket@router1" smqp-consumer-cache-size="10"/>
        </connection-factories>
        <host-access-list/>
      </listener>