Attached you will find a sample configuration that should work.
How do you connect to the durable subscribers?

    TopicConnectionFactory tcf = (TopicConnectionFactory)
ctx.lookup(jmsTopicConnectionFactoryJndiName);
    conn = tcf.createTopicConnection("tester", "password");
    topic = (Topic) ctx.lookup("topic/TEST");
    session = conn.createTopicSession(false,
TopicSession.AUTO_ACKNOWLEDGE);    
    publisher = session.createPublisher(topic);
    conn.start();
    subscriber = session.createDurableSubscriber(topic,
"testSubscription");

Hope this helps,
Sebastian

> -----Original Message-----
> From: Demyanovich, Craig - Apogent [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 25, 2003 4:52 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] How to configure durable topic in 3.0.x
> 
> 
> I spoke too soon; I have not found enough information to 
> create a working durable subscription configuration.  I would 
> appreciate very much if someone would post working examples 
> of the relevant files or would provide some instructions.  I 
> just can't tell at this point if I have one thing wrong in 
> one place or many things wrong in many places.  Here is a 
> snippet of the error that I receive at deployment for my topics:
> 
> 2003-02-25 15:44:29,571 WARN 
> [org.jboss.ejb.plugins.jms.JMSContainerInvoker] JMS provider failure
> detected: 
> org.jboss.mq.SpyJMSException: Cannot subscribe to this 
> Destination: null; - nested throwable: 
> (java.lang.NullPointerException)
>       at org.jboss.mq.Connection.addConsumer(Connection.java:974)
>       at
> org.jboss.mq.SpyConnectionConsumer.<init>(SpyConnectionConsume
> r.java:73)
>       at 
> org.jboss.mq.SpyConnection.createDurableConnectionConsumer(Spy
...
<?xml version="1.0" encoding="UTF-8"?>
<StateManager>
	<Users>
		<User>
			<Name>tester</Name>
			<Password>password</Password>
			<Id>testerID</Id>
		</User>
	</Users>
	<Roles>
	        <!--
		<Role name="testRole">
			<UserName>tester</UserName>
		</Role>
		-->
		<Role name="guest">
			<UserName>tester</UserName>
		</Role>
	</Roles>
	<DurableSubscriptions>
		<DurableSubscription>
			<ClientID>testerID</ClientID>
			<Name>testSubscription</Name>
			<TopicName>TEST</TopicName>
		</DurableSubscription>
	</DurableSubscriptions>
</StateManager>
<?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: jbossmq-service-uil.xml,v 1.1 2003/02/22 02:28:16 sebastian Exp $ -->

<server>
  <!-- ==================================================================== -->
  <!-- JBossMQ                                                              -->
  <!-- ==================================================================== -->


  <!-- ==================================================================== -->
  <!-- Invocation Layers                                                    -->
  <!-- ==================================================================== -->
  <!--
     | InvocationLayers are the different transport methods that can
     | be used to access the server.
   -->

  <mbean code="org.jboss.mq.il.jvm.JVMServerILService"
	 name="jboss.mq:service=InvocationLayer,type=JVM">
    <depends optional-attribute-name="Invoker">jboss.mq:service=Invoker</depends>
    <attribute name="ConnectionFactoryJNDIRef">java:/ConnectionFactory</attribute>
    <attribute name="XAConnectionFactoryJNDIRef">java:/XAConnectionFactory</attribute>
    <attribute name="PingPeriod">0</attribute>
  </mbean>

  <mbean code="org.jboss.mq.il.uil.UILServerILService"
	 name="jboss.mq:service=InvocationLayer,type=UIL">
    <depends optional-attribute-name="Invoker">jboss.mq:service=Invoker</depends>
    <attribute name="ConnectionFactoryJNDIRef">UILConnectionFactory</attribute>
    <attribute name="XAConnectionFactoryJNDIRef">UILXAConnectionFactory</attribute>
    <attribute name="ServerBindPort">8091</attribute>
    <attribute name="PingPeriod">0</attribute>
    <attribute name="EnableTcpNoDelay">true</attribute>

    <!-- 
    <attribute name="ClientSocketFactory">org.jboss.security.ssl.ClientSocketFactory</attribute> 
    <attribute name="ServerSocketFactory">org.jboss.security.ssl.DomainServerSocketFactory</attribute> 
    <attribute name="SecurityDomain">java:/jaas/RMI+SSL</attribute>
     -->
  </mbean>

  
  
  <!-- ==================================================================== -->
  <!-- JBossMQ Interceptor chain configuration                              -->
  <!-- ==================================================================== -->
  <!-- To tune performance, you can have the Invoker skip over the TracingInterceptor -->
  <!-- and/or the SecurityManager, but then you loose the ability to trace and/or enforce security. -->
  
  <mbean code="org.jboss.mq.server.jmx.Invoker" name="jboss.mq:service=Invoker">
    <depends optional-attribute-name="NextInterceptor">jboss.mq:service=TracingInterceptor</depends>
  </mbean>

  <mbean code="org.jboss.mq.server.jmx.InterceptorLoader" name="jboss.mq:service=TracingInterceptor">
    <attribute name="InterceptorClass">org.jboss.mq.server.TracingInterceptor</attribute>
    <depends optional-attribute-name="NextInterceptor">jboss.mq:service=SecurityManager</depends>
  </mbean>

  <mbean code="org.jboss.mq.security.SecurityManager" name="jboss.mq:service=SecurityManager">
    <depends optional-attribute-name="NextInterceptor">jboss.mq:service=DestinationManager</depends>
  </mbean>

  <mbean code="org.jboss.mq.server.jmx.DestinationManager" name="jboss.mq:service=DestinationManager">
    <depends optional-attribute-name="PersistenceManager">jboss.mq:service=PersistenceManager</depends>
    <depends optional-attribute-name="StateManager">jboss.mq:service=StateManager</depends>
  </mbean>


  <!--
     | The MessageCache decides where to put JBossMQ message that
     | are sitting around waiting to be consumed by a client.
     |
     | The memory marks are in Megabytes.  Once the JVM memory usage hits
     | the high memory mark, the old messages in the cache will start getting
     | stored in the DataDirectory.  As memory usage gets closer to the
     | Max memory mark, the amount of message kept in the memory cache aproaches 0.
   -->
  <mbean code="org.jboss.mq.server.MessageCache"
	 name="jboss.mq:service=MessageCache">
    <attribute name="HighMemoryMark">500</attribute>
    <attribute name="MaxMemoryMark">600</attribute>
    <depends optional-attribute-name="CacheStore">jboss.mq:service=CacheStore</depends>
  </mbean>

  <!--
     | The CacheStore decides where to store JBossMQ message that
     | that the MessageCache has decided to move in secondary storage.
   -->
  <mbean code="org.jboss.mq.pm.file.CacheStore"
	 name="jboss.mq:service=CacheStore">
    <attribute name="DataDirectory">tmp/jbossmq</attribute>
  </mbean>

  <!--
     | The StateManager is used to keep JMS persistent state data.
     | For example: what durable subscriptions are active.
   -->
  <mbean code="org.jboss.mq.sm.file.DynamicStateManager"
	 name="jboss.mq:service=StateManager">
    <!-- This file is pulled from the configuration URL of the server -->
    <attribute name="StateFile">jbossmq-state.xml</attribute>
  </mbean>

  <!-- The PersistenceManager is used to store messages to disk. -->
  <mbean code="org.jboss.mq.pm.file.PersistenceManager"
	 name="jboss.mq:service=PersistenceManager">
    <attribute name="DataDirectory">db/jbossmq/file</attribute>
    <depends optional-attribute-name="MessageCache">jboss.mq:service=MessageCache</depends>
  </mbean>

  <!-- 
     | The jdbc2 PersistenceManager is the new improved JDBC implementation.
     | This implementation allows you to control how messages are stored in 
     | the database.
     | 
     | Use this PM if you want the reliablity a relational database can offer 
     | you.  The default configuration is known to work with hsqldb, other databases
     | will requrie teaking of the SqlProperties.
   -->
  <!--
  <mbean code="org.jboss.mq.pm.jdbc2.PersistenceManager"
	 name="jboss.mq:service=PersistenceManager">
    <depends optional-attribute-name="MessageCache">jboss.mq:service=MessageCache</depends>
    <depends optional-attribute-name="DataSource">jboss.jca:service=LocalTxDS,name=hsqldbDS</depends>
    <depends>jboss.jca:service=LocalTxCM,name=hsqldbDS</depends>
    <attribute name="SqlProperties">
      BLOB_TYPE=OBJECT_BLOB
      INSERT_TX = INSERT INTO JMS_TRANSACTIONS (TXID) values(?)
      INSERT_MESSAGE = INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)
      SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS
      SELECT_MAX_TX = SELECT MAX(TXID) FROM JMS_MESSAGES
      SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=?
      SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
      MARK_MESSAGE = UPDATE JMS_MESSAGES SET (TXID, TXOP) VALUES(?,?) WHERE MESSAGEID=? AND DESTINATION=?
      DELETE_ALL_MESSAGE_WITH_TX = DELETE FROM JMS_MESSAGES WHERE TXID=?
      DELETE_TX = DELETE FROM JMS_TRANSACTIONS WHERE TXID = ?
      DELETE_MARKED_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=?
      DELETE_MESSAGE = DELETE FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
      CREATE_MESSAGE_TABLE = CREATE TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, \
         DESTINATION VARCHAR(50) NOT NULL, TXID INTEGER, TXOP CHAR(1), \
         MESSAGEBLOB OBJECT, PRIMARY KEY (MESSAGEID, DESTINATION) )
      CREATE_TX_TABLE = CREATE TABLE JMS_TRANSACTIONS ( TXID INTEGER )
    </attribute>
  </mbean>
  -->


  <!-- ==================================================================== -->
  <!-- System Destinations                                                  -->
  <!-- ==================================================================== -->

  <!-- Dead Letter Queue -->
  <mbean code="org.jboss.mq.server.jmx.Queue"
	 name="jboss.mq.destination:service=Queue,name=DLQ">
    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
    <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
  </mbean>

</server>
<?xml version="1.0" encoding="UTF-8"?>
<server>
   <mbean name="jboss.mq.destination:service=Topic,name=TEST" code="org.jboss.mq.server.jmx.Topic">
      <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
            <!--
            <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
            <attribute name="SecurityConf">
              <security>
                <role name="testRole" read="true" write="true" create="true"/>
              </security>
            </attribute>
            -->
   </mbean>
</server>

Reply via email to