-
1. JBoss register Weblogic Topic mini-howto
pra Sep 1, 2001 1:58 AM (in response to garyg)My solution is not good enough as a patch, but it works. I post it here and hope someone can make it better.
1. write a new WeblogicMQProvider.java. Use source code from ./server/src/main/org/jboss/jms/jndi/JBossMQProvider.java. but change the method getInitialContext() to provide weblogic JNDI context parameter
2. create a weblogic-ds.xml in the deploy/jms. JBossConnectionFactory is the connection factory created in the weblogic server. also, you change ProviderUrl and ProviderAdapterClass as you wish.
<?xml version="1.0" encoding="UTF-8"?>
<connection-factories>
<!-- The Weblogic JMS provider loader -->
WeblogicJMSProvider
WeblogicMQProvider
t3://serverl:80
JBossConnectionFactory
JBossConnectionFactory
</connection-factories>
3. write a new JMSContainerInvoker.java. Copy code from /server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java. do some modification. This is not complete code. You should modify them a little a bit.
Replace orginal code with the follow code in innerCreate().
tsession =
tConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
log.debug("Topic Session set up");
// To be no-durable or durable
if (config.getSubscriptionDurability() != MessageDrivenMetaData.DURABLE_SUBSCRIPTION)
{
// Create non durable
tsubscriber = tsession.createSubscriber(topic);
log.debug("Topic Subscriber set up");
}
else
{
// Durable subscription
String durableName = config.getSubscriptionId();
tsubscriber = tsession.createDurableSubscriber(topic,durableName);
log.debug("Durable Topic Subscriber set up");
}
tsubscriber.setMessageListener(new MessageListenerImpl(this));
log.debug("Topic Subscriber set up its listener");
Replace orginal code with the follow code in innerStop().
try
{
if ( tsession != null )
{
MessageDrivenMetaData config =
((MessageDrivenMetaData)container.getBeanMetaData());
if (config.getSubscriptionDurability() == MessageDrivenMetaData.DURABLE_SUBSCRIPTION) {
// Get configuration information - from EJB-xml
String durableName = config.getSubscriptionId();
tsession.unsubscribe(durableName);
}
}
4. jboss.xml
<message-driven>
<ejb-name>blah blah</ejb-name>
<destination-jndi-name>MessageTopic</destination-jndi-name>
~~~~~~~~~~ JNDI name in weblogic server
<!-- the follow three lines is important-->
<mdb-subscription-id>JBOSS-192.168.1.124</mdb-subscription-id>
<mdb-client-id>QA-JBOSS-192.168.1.124</mdb-client-id>
<configuration-name>JBossMDB</configuration-name>
... ....
</message-driven>
<invoker-proxy-bindings>
<invoker-proxy-binding>
WeblogicBinding
<invoker-mbean>weblogic</invoker-mbean>
<proxy-factory>JMSContainerInvoker</proxy-factory>
<proxy-factory-config>
java:/WeblogicJMSProvider
StdJMSPool
15
1
10
</proxy-factory-config>
</invoker-proxy-binding>
</invoker-proxy-bindings>
<container-configurations>
<container-configuration>
<container-name>RescueMDB</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>WeblogicBinding</invoker-proxy-binding-name>
<container-interceptors>
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor
org.jboss.ejb.plugins.LogInterceptor
org.jboss.ejb.plugins.RunAsSecurityInterceptor
<!-- CMT -->
org.jboss.ejb.plugins.TxInterceptorCMT
org.jboss.ejb.plugins.MetricsInterceptor
org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
<!-- BMT -->
org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT
org.jboss.ejb.plugins.MetricsInterceptor
org.jboss.resource.connectionmanager.CachedConnectionInterceptor
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager> <container-pool-conf>
100 </container-pool-conf>
</container-configuration>
5. package the two java class. copy it and weblogic.jar into server/default/lib. I don't know why wlclient.jar doesn't work.
Andira, I'm sorry that I don't have enough time to polish it better.
brett