Esper Spring JMS output adapter

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

Esper Spring JMS output adapter

by Sandeep Poreddy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi All,

               I was trying to integrate Esper and JMS using the Spring JMS input/output adapters mentioned in the EsperIO documentation. I get the following exception in output adapter.

 

 

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsOutputAdapter' defined in class path resource [jms-spring1.xml]: Cannot resolve reference to bean 'subscriptionOne' while setting bean property 'subscriptionMap' with key [<subscriptionOne>]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'subscriptionOne' defined in class path resource [jms-spring1.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'eventTypeAlias' of bean class [com.espertech.esperio.jms.JMSSubscription]: No property 'eventTypeAlias' found

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedMap(BeanDefinitionValueResolver.java:320)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:134)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

      at java.security.AccessController.doPrivileged(Native Method)

     

 

Below is the Spring JMS configuration for the output adapter.

<?xml version="1.0" encoding="UTF-8"?>

      <!-- Application Context -->

<beans xmlns="http://www.springframework.org/schema/beans"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jms="http://www.springframework.org/schema/jms"

      xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/jms

http://www.springframework.org/schema/jms/spring-jms-2.5.xsd"

      default-destroy-method="destroy">

      <!-- JMS ActiveMQ Connection Factory -->

      <bean id="jmsActiveMQFactory" class="org.apache.activemq.pool.PooledConnectionFactory">

            <property name="connectionFactory">

                  <bean class="org.apache.activemq.ActiveMQConnectionFactory">

                        <property name="brokerURL" value="tcp://localhost:61616" />

                  </bean>

            </property>

      </bean>

      <!-- ActiveMQ destination to use by default -->

      <bean id="defaultDestination" class="org.apache.activemq.command.ActiveMQQueue">

            <constructor-arg value="ESPER.QUEUE" />

      </bean>

      <!-- Spring JMS Template for ActiveMQ -->

      <bean id="jmsActiveMQTemplate" class="org.springframework.jms.core.JmsTemplate">

            <property name="connectionFactory">

                  <ref bean="jmsActiveMQFactory" />

            </property>

            <property name="defaultDestination">

                  <ref bean="defaultDestination" />

            </property>

            <property name="receiveTimeout">

                  <value>30000</value>

            </property>

      </bean>

      <!-- Marshaller marshals events into map messages -->

      <bean id="jmsMessageMarshaller"

            class="com.espertech.esperio.jms.JMSDefaultMapMessageMarshaller" />

      <bean id="myCustomMarshaller"

            class="com.espertech.esperio.jms.JMSDefaultMapMessageMarshaller" />

      <!-- Output adapter puts it all together -->

      <bean id="jmsOutputAdapter"

            class="com.espertech.esperio.jms.SpringJMSTemplateOutputAdapter">

            <property name="jmsTemplate">

                  <ref bean="jmsActiveMQTemplate" />

            </property>

            <property name="subscriptionMap">

                  <map>

                        <entry>

                              <key>

                                    <idref local="subscriptionOne" />

                              </key>

                              <ref bean="subscriptionOne" />

                        </entry>

                        <entry>

                              <key>

                                    <idref local="subscriptionTwo" />

                              </key>

                              <ref bean="subscriptionTwo" />

                        </entry>

                  </map>

            </property>

            <property name="jmsMessageMarshaller">

                  <ref bean="jmsMessageMarshaller" />

            </property>

      </bean>

      <bean id="subscriptionOne" class="com.espertech.esperio.jms.JMSSubscription">

            <property name="eventTypeAlias" value="OutputEvents1" />

      </bean>

      <bean id="subscriptionTwo" class="com.espertech.esperio.jms.JMSSubscription">

            <property name="eventTypeAlias" value="OutputEvents2" />

            <property name="jmsMessageMarshaller">

                  <ref bean="myCustomMarshaller" />

            </property>

      </bean>

</beans>

 

 

Esper.cfg.xml

I have the following setup in the <esper-configuration>

 

<event-type name="OutputEvents1" alias="OutputEvents1">

            <java-util-map>

                  <map-property name="sensorId" class="int" />

                  <map-property name="region" class="string" />

                  <map-property name="message" class="string" />

            </java-util-map>

      </event-type>

 

Please let me know where I’m going wrong.

 

 

Thanks,

Sandeep


Re: Esper Spring JMS output adapter

by Alexandre Vasseur :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can you try with eventTypeName instead of eventTypeAlias in your spring config files?
I believe the doc is wrong for an Esper 3.0 and after.
Also the EsperIO javadoc is missing online but available from: http://esper.codehaus.org/esperio-3.2.0/doc/api/com/espertech/esperio/jms/JMSSubscription.html

Please let us know how it goes.
Alex

On Mon, Sep 28, 2009 at 9:54 PM, Sandeep Poreddy <sandeep.poreddy@...> wrote:

Hi All,

               I was trying to integrate Esper and JMS using the Spring JMS input/output adapters mentioned in the EsperIO documentation. I get the following exception in output adapter.

 

 

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsOutputAdapter' defined in class path resource [jms-spring1.xml]: Cannot resolve reference to bean 'subscriptionOne' while setting bean property 'subscriptionMap' with key [<subscriptionOne>]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'subscriptionOne' defined in class path resource [jms-spring1.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'eventTypeAlias' of bean class [com.espertech.esperio.jms.JMSSubscription]: No property 'eventTypeAlias' found

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedMap(BeanDefinitionValueResolver.java:320)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:134)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

      at java.security.AccessController.doPrivileged(Native Method)

     

 

Below is the Spring JMS configuration for the output adapter.

<?xml version="1.0" encoding="UTF-8"?>

      <!-- Application Context -->

<beans xmlns="http://www.springframework.org/schema/beans"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jms="http://www.springframework.org/schema/jms"

      xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/jms

http://www.springframework.org/schema/jms/spring-jms-2.5.xsd"

      default-destroy-method="destroy">

      <!-- JMS ActiveMQ Connection Factory -->

      <bean id="jmsActiveMQFactory" class="org.apache.activemq.pool.PooledConnectionFactory">

            <property name="connectionFactory">

                  <bean class="org.apache.activemq.ActiveMQConnectionFactory">

                        <property name="brokerURL" value="tcp://localhost:61616" />

                  </bean>

            </property>

      </bean>

      <!-- ActiveMQ destination to use by default -->

      <bean id="defaultDestination" class="org.apache.activemq.command.ActiveMQQueue">

            <constructor-arg value="ESPER.QUEUE" />

      </bean>

      <!-- Spring JMS Template for ActiveMQ -->

      <bean id="jmsActiveMQTemplate" class="org.springframework.jms.core.JmsTemplate">

            <property name="connectionFactory">

                  <ref bean="jmsActiveMQFactory" />

            </property>

            <property name="defaultDestination">

                  <ref bean="defaultDestination" />

            </property>

            <property name="receiveTimeout">

                  <value>30000</value>

            </property>

      </bean>

      <!-- Marshaller marshals events into map messages -->

      <bean id="jmsMessageMarshaller"

            class="com.espertech.esperio.jms.JMSDefaultMapMessageMarshaller" />

      <bean id="myCustomMarshaller"

            class="com.espertech.esperio.jms.JMSDefaultMapMessageMarshaller" />

      <!-- Output adapter puts it all together -->

      <bean id="jmsOutputAdapter"

            class="com.espertech.esperio.jms.SpringJMSTemplateOutputAdapter">

            <property name="jmsTemplate">

                  <ref bean="jmsActiveMQTemplate" />

            </property>

            <property name="subscriptionMap">

                  <map>

                        <entry>

                              <key>

                                    <idref local="subscriptionOne" />

                              </key>

                              <ref bean="subscriptionOne" />

                        </entry>

                        <entry>

                              <key>

                                    <idref local="subscriptionTwo" />

                              </key>

                              <ref bean="subscriptionTwo" />

                        </entry>

                  </map>

            </property>

            <property name="jmsMessageMarshaller">

                  <ref bean="jmsMessageMarshaller" />

            </property>

      </bean>

      <bean id="subscriptionOne" class="com.espertech.esperio.jms.JMSSubscription">

            <property name="eventTypeAlias" value="OutputEvents1" />

      </bean>

      <bean id="subscriptionTwo" class="com.espertech.esperio.jms.JMSSubscription">

            <property name="eventTypeAlias" value="OutputEvents2" />

            <property name="jmsMessageMarshaller">

                  <ref bean="myCustomMarshaller" />

            </property>

      </bean>

</beans>

 

 

Esper.cfg.xml

I have the following setup in the <esper-configuration>

 

<event-type name="OutputEvents1" alias="OutputEvents1">

            <java-util-map>

                  <map-property name="sensorId" class="int" />

                  <map-property name="region" class="string" />

                  <map-property name="message" class="string" />

            </java-util-map>

      </event-type>

 

Please let me know where I’m going wrong.

 

 

Thanks,

Sandeep



RE: Esper Spring JMS output adapter

by Sandeep Poreddy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hey Alex,

                It works !!

 

Thanks a lot!

Sandeep

 

From: Alexandre Vasseur [mailto:avasseur@...]
Sent: Monday, September 28, 2009 3:09 PM
To: user@...
Subject: Re: [esper-user] Esper Spring JMS output adapter

 

Can you try with eventTypeName instead of eventTypeAlias in your spring config files?
I believe the doc is wrong for an Esper 3.0 and after.
Also the EsperIO javadoc is missing online but available from: http://esper.codehaus.org/esperio-3.2.0/doc/api/com/espertech/esperio/jms/JMSSubscription.html

Please let us know how it goes.
Alex

On Mon, Sep 28, 2009 at 9:54 PM, Sandeep Poreddy <sandeep.poreddy@...> wrote:

Hi All,

               I was trying to integrate Esper and JMS using the Spring JMS input/output adapters mentioned in the EsperIO documentation. I get the following exception in output adapter.

 

 

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsOutputAdapter' defined in class path resource [jms-spring1.xml]: Cannot resolve reference to bean 'subscriptionOne' while setting bean property 'subscriptionMap' with key [<subscriptionOne>]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'subscriptionOne' defined in class path resource [jms-spring1.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'eventTypeAlias' of bean class [com.espertech.esperio.jms.JMSSubscription]: No property 'eventTypeAlias' found

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedMap(BeanDefinitionValueResolver.java:320)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:134)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

      at java.security.AccessController.doPrivileged(Native Method)

     

 

Below is the Spring JMS configuration for the output adapter.

<?xml version="1.0" encoding="UTF-8"?>

      <!-- Application Context -->

<beans xmlns="http://www.springframework.org/schema/beans"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jms="http://www.springframework.org/schema/jms"

      xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/jms

http://www.springframework.org/schema/jms/spring-jms-2.5.xsd"

      default-destroy-method="destroy">

      <!-- JMS ActiveMQ Connection Factory -->

      <bean id="jmsActiveMQFactory" class="org.apache.activemq.pool.PooledConnectionFactory">

            <property name="connectionFactory">

                  <bean class="org.apache.activemq.ActiveMQConnectionFactory">

                        <property name="brokerURL" value="tcp://localhost:61616" />

                  </bean>

            </property>

      </bean>

      <!-- ActiveMQ destination to use by default -->

      <bean id="defaultDestination" class="org.apache.activemq.command.ActiveMQQueue">

            <constructor-arg value="ESPER.QUEUE" />

      </bean>

      <!-- Spring JMS Template for ActiveMQ -->

      <bean id="jmsActiveMQTemplate" class="org.springframework.jms.core.JmsTemplate">

            <property name="connectionFactory">

                  <ref bean="jmsActiveMQFactory" />

            </property>

            <property name="defaultDestination">

                  <ref bean="defaultDestination" />

            </property>

            <property name="receiveTimeout">

                  <value>30000</value>

            </property>

      </bean>

      <!-- Marshaller marshals events into map messages -->

      <bean id="jmsMessageMarshaller"

            class="com.espertech.esperio.jms.JMSDefaultMapMessageMarshaller" />

      <bean id="myCustomMarshaller"

            class="com.espertech.esperio.jms.JMSDefaultMapMessageMarshaller" />

      <!-- Output adapter puts it all together -->

      <bean id="jmsOutputAdapter"

            class="com.espertech.esperio.jms.SpringJMSTemplateOutputAdapter">

            <property name="jmsTemplate">

                  <ref bean="jmsActiveMQTemplate" />

            </property>

            <property name="subscriptionMap">

                  <map>

                        <entry>

                              <key>

                                    <idref local="subscriptionOne" />

                              </key>

                              <ref bean="subscriptionOne" />

                        </entry>

                        <entry>

                              <key>

                                    <idref local="subscriptionTwo" />

                              </key>

                              <ref bean="subscriptionTwo" />

                        </entry>

                  </map>

            </property>

            <property name="jmsMessageMarshaller">

                  <ref bean="jmsMessageMarshaller" />

            </property>

      </bean>

      <bean id="subscriptionOne" class="com.espertech.esperio.jms.JMSSubscription">

            <property name="eventTypeAlias" value="OutputEvents1" />

      </bean>

      <bean id="subscriptionTwo" class="com.espertech.esperio.jms.JMSSubscription">

            <property name="eventTypeAlias" value="OutputEvents2" />

            <property name="jmsMessageMarshaller">

                  <ref bean="myCustomMarshaller" />

            </property>

      </bean>

</beans>

 

 

Esper.cfg.xml

I have the following setup in the <esper-configuration>

 

<event-type name="OutputEvents1" alias="OutputEvents1">

            <java-util-map>

                  <map-property name="sensorId" class="int" />

                  <map-property name="region" class="string" />

                  <map-property name="message" class="string" />

            </java-util-map>

      </event-type>

 

Please let me know where I’m going wrong.

 

 

Thanks,

Sandeep