"[EMAIL PROTECTED]" wrote : FAQ:
http://www.jboss.org/wiki/Wiki.jsp?page=WhatIsTheCorrectWayToMakeADurableSubscription
|
| Preconfigured clients ids (for the testsuite) from
deploy/jms/hsqldb-jdbc-state-service.xml:
|
| | POPULATE.TABLES.03 = INSERT INTO JMS_USERS (USERID, PASSWD,
CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
| |
|
|
|
I seems to me that we could solve the problem. We have modified our code and
hacked the jms-ra.rar as well.
Regarding our code, we added the following to the message producer:
connection.setClientID("10001");
So, we do the following in the producer:
| connection = connectionFactory.createTopicConnection("guest","guest"); //
previously we used createTopicConnection(void)
| connection.start();
| connection.setClientID("10001"); // new line
| session = connection.createTopicSession(true, 0);
| session.createDurableSubscriber((Topic)topic,"MySubscriptionName");
// new line
| publisher = session.createProducer(topic);
| publisher.setDeliveryMode(DeliveryMode.PERSISTENT);
|
However, when we tried to set the client identifier, JBoss thrown
IllegalStateException claiming that "This method is not applicatable in JMS
resource adapter".
Thereafter, we looked into the source code of method
JmsSessionFactoryImpl.setClientID(String), which actually throws the exception.
Here it is:
| public void setClientID(String cID)
| throws JMSException
| {
| if(mcf.isStrict())
| throw new IllegalStateException("This method is not
applicatable in JMS resource adapter");
| checkClosed();
| if(clientID != null)
| {
| throw new IllegalStateException("Cannot change client id");
| } else
| {
| clientID = cID;
| return;
| }
| }
|
Okay, we realized that the corresponding ManagedConnectionFactory (mcf) has to
be strict. Unfortunately, according to the JMX console the mcf is obviously
strict.
After some research on the web, we learnt that we can configure this attribute
in ra.xml located in jms-ra.rar.
Well, this finding was followed by some minimal hacking, which resulted in the
following modified ra.xml:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <!-- $Id: ra.xml,v 1.12 2004/08/11 21:05:49 ejort Exp $ -->
|
| <connector xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
| http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
| version="1.5">
|
| <description>JBoss JMS Resource Adapter</description>
| <display-name>JMS Adapter</display-name>
|
| <vendor-name>JBoss, Inc</vendor-name>
| <eis-type>JMS 1.1 Server</eis-type>
| <resourceadapter-version>4.0</resourceadapter-version>
|
| <license>
| <description>
| COPYRIGHT AND PERMISSION NOTICE
| Copyright (c) 2004 JBoss, Inc
| This is released under the terms of the LGPL.
| See gnu.org for details.
| </description>
| <license-required>true</license-required>
| </license>
|
| <resourceadapter>
|
<resourceadapter-class>org.jboss.resource.adapter.jms.JmsResourceAdapter</resourceadapter-class>
|
| <outbound-resourceadapter>
| <connection-definition>
|
<managedconnectionfactory-class>org.jboss.resource.adapter.jms.JmsManagedConnectionFactory</managedconnectionfactory-class>
| <config-property>
| <description>The jndi name of the provider of connection
factories</description>
|
<config-property-name>JmsProviderAdapterJNDI</config-property-name>
| <config-property-type>java.lang.String</config-property-type>
|
<config-property-value>java:DefaultJMSProvider</config-property-value>
| </config-property>
| <config-property>
| <description>The default session type</description>
|
<config-property-name>SessionDefaultType</config-property-name>
| <config-property-type>java.lang.String</config-property-type>
|
<config-property-value>javax.jms.Topic</config-property-value>
| </config-property>
| <config-property>
| <description>The user name used to login to the jms
server</description>
| <config-property-name>UserName</config-property-name>
| <config-property-type>java.lang.String</config-property-type>
| <config-property-value></config-property-value>
| </config-property>
| <config-property>
| <description>The password used to login to the jms
server</description>
| <config-property-name>Password</config-property-name>
|
<config-property-type>java.lang.String</config-property-type>
| <config-property-value></config-property-value>
| </config-property>
| <config-property>
| <description>The client id for this connection
factory</description>
| <config-property-name>ClientID</config-property-name>
|
<config-property-type>java.lang.String</config-property-type>
| <config-property-value></config-property-value>
| </config-property>
| <config-property>
| <config-property-name>Strict</config-property-name>
|
<config-property-type>java.lang.Boolean</config-property-type>
| <config-property-value>false</config-property-value> <!-- by
default was true -->
| </config-property>
|
<connectionfactory-interface>org.jboss.resource.adapter.jms.JmsConnectionFactory</connectionfactory-interface>
|
<connectionfactory-impl-class>org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl</connectionfactory-impl-class>
| <connection-interface>javax.jms.Session</connection-interface>
|
<connection-impl-class>org.jboss.resource.adapter.jms.JmsSession</connection-impl-class>
| </connection-definition>
| <transaction-support>XATransaction</transaction-support>
| <authentication-mechanism>
|
<authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
|
<credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
| </authentication-mechanism>
| <reauthentication-support>false</reauthentication-support>
| </outbound-resourceadapter>
|
| <inbound-resourceadapter>
| <messageadapter>
| <messagelistener>
|
<messagelistener-type>javax.jms.MessageListener</messagelistener-type>
| <activationspec>
|
<activationspec-class>org.jboss.resource.adapter.jms.inflow.JmsActivationSpec</activationspec-class>
| <required-config-property>
|
<config-property-name>destination</config-property-name>
| </required-config-property>
| <required-config-property>
|
<config-property-name>destinationType</config-property-name>
| </required-config-property>
| </activationspec>
| </messagelistener>
| </messageadapter>
| </inbound-resourceadapter>
|
| </resourceadapter>
| </connector>
| [\code]
|
| This modification added an extra durable subscriber to the topic, and made
the topic durable (txop values are 'A'). So, now we have two subscribers, the
new one is durable, and our MDB is (against all of our efforts) is non-durable.
|
| The problem is, that this is obviously a hacked workaround and not a real
solution, and we do not release a "patched" jms-ra.rar (JBoss 4.0.1) along with
our product(s).
|
| What is your opinion about this "solution"?
|
| Do you have an idea how can we make our MDB durable?
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3863526#3863526
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3863526
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user