[JBoss Messaging] - help on JmsXA
by mattlf
Hi
I am new to jboss messaging and i apologize if my question turns out to be silly.
I have a sender that createConnection, createSession and createProducer on every message. I am concerned this is very inefficient. I read on some other posts that it is acceptable if one uses JmsXA
| public class JmsPublisher
| {
|
| private ConnectionFactory bizConnectionFactory ;
| private Destination bizDestination;
|
|
| public ConnectionFactory getBizConnectionFactory() {
| return bizConnectionFactory;
| }
| public void setBizConnectionFactory(ConnectionFactory bizConnectionFactory) {
| this.bizConnectionFactory = bizConnectionFactory;
| }
| public Destination getBizDestination() {
| return bizDestination;
| }
| public void setBizDestination(Destination bizDestination) {
| this.bizDestination = bizDestination;
| }
|
| public JmsPublisher(){}
|
| public void sendEvent(SignalAbstract ev)
| throws
| JMSException
| {
| Connection connection = null;
| Session session = null;
| MessageProducer messageProducer = null;
|
| try
| {
|
| connection = bizConnectionFactory.createConnection();
| session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
| messageProducer = session.createProducer(bizDestination);
|
| ObjectMessage msg = session.createObjectMessage(ev);
|
| messageProducer.send(msg);
|
| }
| finally
| {
| if (messageProducer != null) try { messageProducer.close(); } catch (Exception ignore) { }
| if (session != null) try { session.close(); } catch (Exception ignore) { }
| if (connection != null) try { connection.close(); } catch (Exception ignore) { }
|
| }
|
| }
|
| }
|
I inject the jndi name via Spring
| <jee:jndi-lookup id="bizConnectionFactory"
| jndi-name="${biz.messagingConnectionFactoryName}">
| <jee:environment>
| java.naming.provider.url=${biz.messagingProviderUrl}
| java.naming.factory.url.pkgs=org.jnp.interfaces:org.jboss.naming
| java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| </jee:environment>
| </jee:jndi-lookup>
|
| <jee:jndi-lookup id="bizDestination"
| jndi-name="${biz.messagingDestinationName}">
| <jee:environment>
| java.naming.provider.url=${biz.messagingProviderUrl}
| java.naming.factory.url.pkgs=org.jnp.interfaces:org.jboss.naming
| java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| </jee:environment>
| </jee:jndi-lookup>
|
| <bean class="com.strateer.biz.impl.JmsPublisher"
| id="bizJmsPublisher">
| <property name="bizConnectionFactory" ref="bizConnectionFactory" />
| <property name="bizDestination" ref="bizDestination" />
| </bean>
|
It works when
| biz.messagingProviderUrl=localhost:1099
| biz.messagingConnectionFactoryName=ConnectionFactory
|
but it doesn't when i change the connectionFactoryName to java:/JmsXA
| biz.messagingProviderUrl=localhost:1099
| biz.messagingConnectionFactoryName=java:/JmsXA
|
The logs say the following:
Error creating bean with name 'bizConnectionFactory': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JmsXA
And i don't seem to be able to get it working.
I would appreciate some tips
Thank you for your help
matt
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160080#4160080
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160080
17 years, 10 months
[JBoss Portal] - supported-modes explanation
by ghyoju
Hi,
It seems we can have supported-modes option with portal-objects.xml. As per document if supported-modes is not declared, by default it uses view,edit,help.
The question I have is if a portle.xml has declared a porlet which supports VIEW, EDIT and HELP capability, can the portal-object.xml override one of these option by using supported-modes option.
I want to hide the edit option so that users cannot change the preferences.
portlet.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd /opt/SUNWps/dtd/portlet.xsd"
| version="1.0">
| <portlet>
| <portlet-name>MyPortlet</portlet-name>
| <portlet-class>org.jboss.portlet.hello.MyPortlet</portlet-class>
| <supports>
| <mime-type>text/html</mime-type>
| <portlet-mode>VIEW</portlet-mode>
| <portlet-mode>EDIT</portlet-mode>
| <portlet-mode>HELP</portlet-mode>
| </supports>
| <portlet-info>
| <title>MyPortlet</title>
| </portlet-info>
| </portlet>
| </portlet-app>
|
portal-object.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <deployments>
| <deployment>
| <parent-ref/>
| <if-exists>overwrite</if-exists>
| <portal>
| <portal-name>HelloPortal</portal-name>
| <properties>
| <!-- Set the layout for the default portal -->
| <!-- see also portal-layouts.xml -->
| <property>
| <name>layout.id</name>
| <value>generic</value>
| </property>
| <!-- Set the theme for the default portal -->
| <!-- see also portal-themes.xml -->
| <property>
| <name>theme.id</name>
| <value>Nphalanx</value>
| </property>
| <!-- set the default render set name (used by the render tag in layouts) -->
| <!-- see also portal-renderSet.xml -->
| <property>
| <name>theme.renderSetId</name>
| <value>divRenderer</value>
| </property>
| <!-- set the default strategy name (used by the strategy interceptor) -->
| <!-- see also portal-strategies.xml -->
| <property>
| <name>layout.strategyId</name>
| <value>maximizedRegion</value>
| </property>
| </properties>
| <supported-modes>
| <mode>view</mode>
| <mode>view</mode>
| <mode>help</mode>
| </supported-modes>
| <supported-window-states>
| <window-state>normal</window-state>
| <window-state>minimized</window-state>
| <window-state>maximized</window-state>
| </supported-window-states>
| <security-constraint>
| <policy-permission>
| <role-name>User</role-name>
| <action-name>viewrecursive</action-name>
| </policy-permission>
| <policy-permission>
| <role-name>Admin</role-name>
| <action-name>viewrecursive</action-name>
| </policy-permission>
| </security-constraint>
| <page>
| <page-name>default</page-name>
| <properties/>
| <window>
| <window-name>MyPortletWindow</window-name>
| <instance-ref>MyPortletInstance</instance-ref>
| <region>center</region>
| <height>0</height>
| </window>
| </page>
| </portal>
| </deployment>
| </deployments>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160062#4160062
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160062
17 years, 10 months