[JBoss Messaging] - Re: Embedded server - how to create JMS Topic?
by Leos.Bitto
"rkapur123" wrote : Hi Leos.bitto
|
| I have jboss SOA 4.3 ESB which has Jboss Messaging as messaging provoder.
|
| Using Spring framework's MDP (message driven pojo) - I want to listen on "sampleQueue". As per springframework 2.5 guide - MDP is a simple class which implements javax.jms.MessageListener onMessage().
|
I do not use any support for JMS from Spring, because my trust in their JMS code vanished when I found out how terribly inefficient is their JmsTemplate. So I have studied the JMS 1.1 specification and wrote the necessarry code myself - it was not difficult, and I got a code which performs much better.
"rkapur123" wrote :
| I have the class and specified the following in applicationContext.xml file
|
|
| | <bean id="messageListener" class="com.acme.SpringMDP" />
| |
| | <bean id="listenerContainer"
| | class="org.springframework.jms.listener.DefaultMessageListenerContainer">
| | <property name="concurrentConsumers" value="5" />
| | <property name="destination" ref="destination" />
| | <property name="connectionFactory" ref="connectionFactory" />
| | <property name="messageListener" ref="messageListener" />
| | </bean>
| |
|
| but how should I define "connectionFactory" and "destination" in spring context file.
|
There are more possibilities, but the most versatile one seems to be to use JNDI - that actually makes your code compatible with most JMS providers, not only JBoss Messaging. Check the chapter 5.3. JNDI configuration of the JBoss Messaging documentation and use something like this (not tested):
| <bean name="jbmJndiEnv">
| <props>
| <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
| <prop key="java.naming.provider.url">jnp://myhost:1099</prop>
| <prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
| </props>
| </property>
|
| <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
| <property name="jndiEnvironment" ref="jbmJndiEnv" />
| <property name="lookupOnStartup" value="false"/>
| <property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
| <property name="jndiName" value="ConnectionFactory" />
| </bean>
|
| <bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
| <property name="jndiEnvironment" ref="jbmJndiEnv" />
| <property name="lookupOnStartup" value="false"/>
| <property name="proxyInterface" value="javax.jms.Destination" />
| <property name="jndiName" value="/queue/ExampleQueue" />
| </bean>
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4243200#4243200
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4243200
17 years
[EJB 3.0] - ManyToMany prob. with reading lists from entities
by NSchweig
Hi,
I have got two Entities. Appointment and AppointmentOffer.
The relation is @ManyToMany.
Appointment.java
//bidirektional, inverse Seite
| @ManyToMany(fetch=FetchType.EAGER,mappedBy="appointments",cascade=CascadeType.MERGE)
| @IndexColumn(name="INDEX_COL")
| private List<AppointmentOffer> appointmentOffers= new ArrayList<AppointmentOffer>();
AppointmentOffer.java
| //bidirektional, besitzende Seite
| @ManyToMany(fetch=FetchType.EAGER)
| @IndexColumn(name="INDEX_COL")
| private List<Appointment> appointments = new ArrayList<Appointment>();
I have got two jsf-pages. One is first reading the appointmentOffers and then reading the list with appointments from this offers:
show_appointment_offers.xhtml
| <rich:dataTable value="#{appointmentBeanInst.appointmentOffers}" var="appOffer">
| <rich:column>
| <h:outputText value="#{appOffer.id}" />
| </rich:column>
| ...
| <rich:column>
| <h:dataTable value="#{appOffer.appointments}" var="app">
| <h:column>
| <h:outputText value="#{app.title}" />
| </h:column>
| </rich:column>
| </rich:dataTable>
The second pages tries to do the same with the appointments:
show_appointments.xhtml
<rich:dataTable value="#{appointmentBeanInst.freeAppointments}" var="appointment" >
| <rich:column sortBy="#{appointment.title}">
| <h:outputText value="#{appointment.title}" />
| </rich:column>
| ...
| <rich:column>
| <h:dataTable value="#{appointment.appointmentOffers}" var="appOffer">
| <h:column>
| <h:outputText value="#{appOffer.title}" />
| </h:column>
| </h:dataTable>
| ...
|
The problem is that in the second page only one of the appointmentOffers is shown (in the list is only one appointmentOffer). I do not understand this. The only difference between the first and the second page is that appointmentOffer is the owner side. Is that the reason? How can I solve this?
Thanks for your hints.
NSchweig
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4243195#4243195
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4243195
17 years