activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From javaxmlsoapdev <vika...@yahoo.com>
Subject Re: How to create Session while using Jencks
Date Fri, 11 Aug 2006 13:59:40 GMT

Thanks for the response James.

Can you advise, what's wrong with following configs and producer code? I
dont' get any error and code compiles runs fine. but when I run JMX from
activemq directory and try to connect to localhost and port  61613, it keeps
on saying that config wrong , can't connect. That's why I am wondering how
do I validate that my code is creating Queue successfully and putting the
message? Do I miss anything basic? 

activemq.xml is as below.
<broker xmlns="http://activemq.org/config/1.0" useJmx="true">
  
  
  
    
    <destinationPolicy>
      <policyMap><policyEntries>
        
          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>
  
  
    <persistenceAdapter>
      <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"/>
      
    </persistenceAdapter>
  
    <transportConnectors>
       <transportConnector name="default" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
       <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
    </transportConnectors>
    
    <networkConnectors>
      
      <networkConnector name="default" uri="multicast://default"/>
      
    </networkConnectors>
    
  </broker>
---end of activemq.xml--

---start of jencks related config.--
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.org/config/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://activemq.org/config/1.0 
http://people.apache.org/repository/org.apache.activemq/xsds/activemq-core-4.1-incubator-SNAPSHOT.xsd">


<!--  lets create an embedded ActiveMQ Broker -->
  <amq:broker useJmx="true" persistent="false">
    <amq:transportConnectors>
      <amq:transportConnector uri="tcp://localhost:61616" />
    </amq:transportConnectors>
  </amq:broker>
        
	  <bean id="orderMessageProducer"
class="com.xxx.xxx.messaging.OrderMessageProducer">
       		<constructor-arg ref="jmsTemplate" />
       		<constructor-arg ref="destination" />
	  </bean>
	 		
	  <!--   ###### Transaction manager ###### -->
	
	  <bean id="transactionContextManager"
class="org.jencks.factory.TransactionContextManagerFactoryBean" />
	  <bean id="userTransaction"
class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" />
	  <bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
	    <property name="userTransaction" ref="userTransaction" />
	  </bean>
	
	  <!--  ###### JCA ######  -->
	
	  <bean id="transactionSupport"
class="org.jencks.factory.XATransactionFactoryBean">
	    <property name="useTransactionCaching" value="true" />
	    <property name="useThreadCaching" value="true" />
	  </bean>
	
	  <bean id="poolingSupport"
class="org.jencks.factory.SinglePoolFactoryBean">
	    <property name="maxSize" value="2" />
	    <property name="minSize" value="1" />
	    <property name="blockingTimeoutMilliseconds" value="60" />
	    <property name="idleTimeoutMinutes" value="60" />
	    <property name="matchOne" value="true" />
	    <property name="matchAll" value="true" />
	    <property name="selectOneAssumeMatch" value="true" />
	  </bean>
	
	  <bean id="connectionManager"
class="org.jencks.factory.ConnectionManagerFactoryBean">
	    <property name="transactionSupport" ref="transactionSupport" />
	    <property name="poolingSupport" ref="poolingSupport" />
	  </bean>
	
	  <!-- ###### JMS ######  -->
	
	  <!-- <bean id="broker"
class="org.apache.activemq.xbean.BrokerFactoryBean">
	    <property name="config" value="/WEB-INF/activemq.xml"/>
	    <property name="start" value="true" />
	  </bean> -->
	
	  <bean id="jmsResourceAdapter"
class="org.apache.activemq.ra.ActiveMQResourceAdapter">
	    <property name="serverUrl" value="tcp://localhost:61616" />
	    <!-- <property name="serverUrl" value="tcp://localhost:0" /> -->
	  </bean>
	
	  <bean id="jmsManagedConnectionFactory"
class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory">
	    <property name="resourceAdapter" ref="jmsResourceAdapter" />
	  </bean>
	
	  <bean id="jmsConnectionFactory"
class="org.springframework.jca.support.LocalConnectionFactoryBean">
	    <property name="managedConnectionFactory"
ref="jmsManagedConnectionFactory" />
	    <property name="connectionManager" ref="connectionManager" />
	  </bean>
	
      <bean id="destination"
class="org.apache.activemq.command.ActiveMQQueue" autowire="constructor">
		
<constructor-arg><value>com.xxx.xxx.queue.order.embedded</value></constructor-arg>
      </bean>
           
	  
      <bean id="jmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
    	<property name="connectionFactory" ref="jmsConnectionFactory" />
        <property name="defaultDestination" ref="destination" />
        
    </bean>
</beans>

----end of jencks config --

--snippet of producer code --

jmsTemplate.convertAndSend(destination, order,new MessagePostProcessor() {
    	    public Message postProcessMessage(Message message) throws
JMSException {
    	    	
    	    	message.setObjectProperty("order", "Order Testing");
    	    	message.setStringProperty("JMSXGroupID", "Series1");
    	      
    	    	return message;
    	    }
    	  });

--end snipped of producer code



James.Strachan wrote:
> 
> On 8/10/06, javaxmlsoapdev <vikasdp@yahoo.com> wrote:
>> I am confused about how to create JMS session pool while using Jencks?
> 
> You don't need to - Jencks does that for you
> 
>> couldn't find any example showing creating pool of sessions. Also, how to
>> use this Jencks created session in Spring Producer code before sending
>> message to broker? Any pointers, examples would be appreciated.
> 
> See this example
> 
> http://jencks.org/Outbound+JMS
> 
> you get a proxy JMS ConnectionFactory that you just use as normal in
> JmsTemplate
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-create-Session-while-using-Jencks-tf2087219.html#a5762716
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message