You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by avin98 <av...@yahoo.com> on 2006/12/08 02:12:40 UTC

ActiveMQ Broker Connection

I have defined my JMS resources within the resource plan. I define a resource
adapter somewhat similar to this.
However the point of importance here is that I define my Active MQ to be
hosted on a different server location as follows:

<config-property-setting name="ServerUrl">
        tcp://server2:61616
</config-property-setting>


the problem that I am facing is that everytime, I restart the server2, I
need to correspondingly restart my server on localhost. Can this be avoided
somehow ?

I get a javax.jms.JMSException: syncSendTimedOut: connection no longer OK 

if I don't restart my server

---------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<connector
    xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
    <environment
        xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
        <moduleId>
            <groupId>console.jms</groupId>
            <artifactId>SampleResourceGroup</artifactId>
            <version>1.0</version>
            <type>rar</type>
        </moduleId>
        <dependencies>
            <dependency>
                <groupId>geronimo</groupId>
                <artifactId>activemq-broker</artifactId>
                <type>car</type>
            </dependency>
        </dependencies>
    </environment>

  <resourceadapter>
    <!-- how to connect to the JMS Server -->
    <resourceadapter-instance>
      <resourceadapter-name>
        My JMS Resources
      </resourceadapter-name>
      <config-property-setting name="ServerUrl">
        tcp://server2:61616
      </config-property-setting>
      <config-property-setting name="UserName">
        geronimo
      </config-property-setting>
      <config-property-setting name="Password">
        geronimo
      </config-property-setting>
      <workmanager>
        <gbean-link>DefaultWorkManager</gbean-link>
      </workmanager>
    </resourceadapter-instance>
    <!-- defines a ConnectionFactory -->
    <outbound-resourceadapter>
      <connection-definition>
        <connectionfactory-interface>
          javax.jms.ConnectionFactory
        </connectionfactory-interface>
        <connectiondefinition-instance>
          <name>MyConnectionFactory</name>
          <implemented-interface>
            javax.jms.QueueConnectionFactory
          </implemented-interface>
          <implemented-interface>
            javax.jms.TopicConnectionFactory
          </implemented-interface>
          <connectionmanager>
            <xa-transaction>
              <transaction-caching />
            </xa-transaction>
            <single-pool>
              <max-size>10</max-size>
              <min-size>0</min-size>
              <blocking-timeout-milliseconds>
                5000
              </blocking-timeout-milliseconds>
              <idle-timeout-minutes>
                0
              </idle-timeout-minutes>
              <match-one/>
            </single-pool>
          </connectionmanager>
        </connectiondefinition-instance>
      </connection-definition>
    </outbound-resourceadapter>
  </resourceadapter>
  <!-- defines a Topic -->
  <adminobject>
    <adminobject-interface>
      javax.jms.Topic
    </adminobject-interface>
    <adminobject-class>
      org.activemq.message.ActiveMQTopic
    </adminobject-class>
    <adminobject-instance>
      <message-destination-name>
        MyTopic
      </message-destination-name>
      <config-property-setting name="PhysicalName">
        MyTopic
      </config-property-setting>
    </adminobject-instance>
  </adminobject>
  <!-- defines a Queue -->
  <adminobject>
    <adminobject-interface>
      javax.jms.Queue
    </adminobject-interface>
    <adminobject-class>
      org.activemq.message.ActiveMQQueue
    </adminobject-class>
    <adminobject-instance>
      <message-destination-name>
        MyQueue
      </message-destination-name>
      <config-property-setting name="PhysicalName">
        MyQueue
      </config-property-setting>
    </adminobject-instance>
  </adminobject>
</connector>


-- 
View this message in context: http://www.nabble.com/ActiveMQ-Broker-Connection-tf2778167.html#a7751140
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: ActiveMQ Broker Connection

Posted by David Jencks <da...@yahoo.com>.
On Dec 7, 2006, at 5:12 PM, avin98 wrote:

>
> I have defined my JMS resources within the resource plan. I define  
> a resource
> adapter somewhat similar to this.
> However the point of importance here is that I define my Active MQ  
> to be
> hosted on a different server location as follows:
>
> <config-property-setting name="ServerUrl">
>         tcp://server2:61616
> </config-property-setting>
>
>
> the problem that I am facing is that everytime, I restart the  
> server2, I
> need to correspondingly restart my server on localhost. Can this be  
> avoided
> somehow ?
>
> I get a javax.jms.JMSException: syncSendTimedOut: connection no  
> longer OK

I think you can expect that if you break all the connections in the  
pool, you will need to try to use each one so it will discover that  
it's broken and get shut down by the pool.  After you've tried all  
the broken connections you should start getting new, working,  
connections.

There could be some bugs in the way of this working in the activemq  
rar.  For instance, the managed connection might not report the error  
to the connection event listener, in which case geronimo wouldn't  
know to destroy the (broken) connection.

It's been a while since I looked at the spec but IIRC there's some  
interface amq could implement so geronimo can test connections  
periodically.  Then the pooling code would find most of the broken  
connections rather than leaving it up to your app.  I don't think  
we've implemented support for this feature in geronimo, but it  
shouldn't be too hard.

btw I think you don't need the dependency on activemq-broker.  For  
instance, it doesn't have to be running.... your broker is on another  
machine.

thanks
david jencks

>
> if I don't restart my server
>
> ---------------------------------------------------------------------- 
> -----------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <connector
>     xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
>     <environment
>         xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
>         <moduleId>
>             <groupId>console.jms</groupId>
>             <artifactId>SampleResourceGroup</artifactId>
>             <version>1.0</version>
>             <type>rar</type>
>         </moduleId>
>         <dependencies>
>             <dependency>
>                 <groupId>geronimo</groupId>
>                 <artifactId>activemq-broker</artifactId>
>                 <type>car</type>
>             </dependency>
>         </dependencies>
>     </environment>
>
>   <resourceadapter>
>     <!-- how to connect to the JMS Server -->
>     <resourceadapter-instance>
>       <resourceadapter-name>
>         My JMS Resources
>       </resourceadapter-name>
>       <config-property-setting name="ServerUrl">
>         tcp://server2:61616
>       </config-property-setting>
>       <config-property-setting name="UserName">
>         geronimo
>       </config-property-setting>
>       <config-property-setting name="Password">
>         geronimo
>       </config-property-setting>
>       <workmanager>
>         <gbean-link>DefaultWorkManager</gbean-link>
>       </workmanager>
>     </resourceadapter-instance>
>     <!-- defines a ConnectionFactory -->
>     <outbound-resourceadapter>
>       <connection-definition>
>         <connectionfactory-interface>
>           javax.jms.ConnectionFactory
>         </connectionfactory-interface>
>         <connectiondefinition-instance>
>           <name>MyConnectionFactory</name>
>           <implemented-interface>
>             javax.jms.QueueConnectionFactory
>           </implemented-interface>
>           <implemented-interface>
>             javax.jms.TopicConnectionFactory
>           </implemented-interface>
>           <connectionmanager>
>             <xa-transaction>
>               <transaction-caching />
>             </xa-transaction>
>             <single-pool>
>               <max-size>10</max-size>
>               <min-size>0</min-size>
>               <blocking-timeout-milliseconds>
>                 5000
>               </blocking-timeout-milliseconds>
>               <idle-timeout-minutes>
>                 0
>               </idle-timeout-minutes>
>               <match-one/>
>             </single-pool>
>           </connectionmanager>
>         </connectiondefinition-instance>
>       </connection-definition>
>     </outbound-resourceadapter>
>   </resourceadapter>
>   <!-- defines a Topic -->
>   <adminobject>
>     <adminobject-interface>
>       javax.jms.Topic
>     </adminobject-interface>
>     <adminobject-class>
>       org.activemq.message.ActiveMQTopic
>     </adminobject-class>
>     <adminobject-instance>
>       <message-destination-name>
>         MyTopic
>       </message-destination-name>
>       <config-property-setting name="PhysicalName">
>         MyTopic
>       </config-property-setting>
>     </adminobject-instance>
>   </adminobject>
>   <!-- defines a Queue -->
>   <adminobject>
>     <adminobject-interface>
>       javax.jms.Queue
>     </adminobject-interface>
>     <adminobject-class>
>       org.activemq.message.ActiveMQQueue
>     </adminobject-class>
>     <adminobject-instance>
>       <message-destination-name>
>         MyQueue
>       </message-destination-name>
>       <config-property-setting name="PhysicalName">
>         MyQueue
>       </config-property-setting>
>     </adminobject-instance>
>   </adminobject>
> </connector>
>
>
> -- 
> View this message in context: http://www.nabble.com/ActiveMQ-Broker- 
> Connection-tf2778167.html#a7751140
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>