activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eadno1 <eld...@alphacsp.com>
Subject Re: PrefetchPolicy & more - all not working when embedding ActiveMQ into JBoss
Date Tue, 19 May 2009 14:46:54 GMT

I assume your assumption is correct, or there's away to embed a broker to
Jboss
and the broker will be considered internal???

I did realize that 2 Brokers were created, actually they appear to override
each other
so only the latter get used from my EJBs & only one is shown in jconsole.

second - it says when using embedded broker you have to use the vm://...
option ( anyways I tried
using the tcp:// and it didn't work )

Is there a way to set the prefetchPolicy to a vm:// broker ??? (when placed
in the <transportConnector> it throws exception and when trying using in the
<networkConnector> it doesn't work, each I assume it
doesn't suppose to work like that)


Gary Tully wrote:
> 
> A network bridge has its own prefetch attribute. I think this will
> override
> any url parameter.
> 
> It looks like you may have two embedded brokers started here, one from the
> ra.xml xml config and one from the "vm://" connection url. Either add
> create=false&waitForStart=5000 to the vm://.. url (so that it won't create
> an embedded broker) or use the tcp variant that matches the
> transportConnector in activemq.xml.
> 
> I imagine/assume the intention is to have one embedded broker network with
> an external broker.
> 
> 
> 2009/5/19 Eadno1 <eldadd@alphacsp.com>
> 
>>
>> I've been playing around with ActiveMQ for a while now, and
>> I'm trying...really hard...to configure it (Like they explain here -
>> http://activemq.apache.org/what-is-the-prefetch-limit-for.html)
>>
>> it's all not working, and I've finally understood why, are least I
>> understand why, but
>> solving it - I'm baffled!
>>
>> so this is what I'm running against :
>> ~~~~~~~~~~~~~~~~~~~~~~
>>
>> broker-config.xml :
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!--
>>    Licensed to the Apache Software Foundation (ASF) under one or more
>>    contributor license agreements.  See the NOTICE file distributed with
>>    this work for additional information regarding copyright ownership.
>>    The ASF licenses this file to You under the Apache License, Version
>> 2.0
>>    (the "License"); you may not use this file except in compliance with
>>    the License.  You may obtain a copy of the License at
>>
>>    http://www.apache.org/licenses/LICENSE-2.0
>>
>>    Unless required by applicable law or agreed to in writing, software
>>    distributed under the License is distributed on an "AS IS" BASIS,
>>    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>>    See the License for the specific language governing permissions and
>>    limitations under the License.
>> -->
>> <!-- START SNIPPET: xbean -->
>> <beans xmlns="http://activemq.apache.org/schema/core">
>>
>>  <broker useJmx="true" brokerName="my.broker1">
>>
>> <!-- put the following as the first child of the broker tag -->
>> <managementContext><!-- we'll use an existing one (JBoss) instead of
>> creating one -->
>>  <managementContext createConnector="false"/>
>> </managementContext>
>>
>>
>>        <!-- In ActiveMQ 4, you can setup destination policies. note: this
>> xml
>> format may still change a bit -->
>>    <destinationPolicy>
>>      <policyMap><policyEntries>
>>
>>          <policyEntry topic="FOO.>">
>>            <dispatchPolicy>
>>              <strictOrderDispatchPolicy />
>>            </dispatchPolicy>
>>            <subscriptionRecoveryPolicy>
>>              <lastImageSubscriptionRecoveryPolicy />
>>            </subscriptionRecoveryPolicy>
>>          </policyEntry>
>>
>>      </policyEntries></policyMap>
>>    </destinationPolicy>
>>
>>
>>         <persistenceAdapter>
>>            <amqPersistenceAdapter syncOnWrite="false" directory="/data"
>> maxFileLength="20 mb"/>
>>        </persistenceAdapter>
>>
>>
>>  <!--  <persistenceAdapter>
>>      <journaledJDBC journalLogFiles="5" dataDirectory="/data" />-->
>>      <!-- To use a different datasource, use th following syntax : -->
>>       <!--  <journaledJDBC journalLogFiles="5" dataDirectory="../data"
>> dataSource="#postgres-ds"/>
>>      </persistenceAdapter>-->
>>
>>    <transportConnectors>
>>      <!-- prefixing a connector with discovery: causes the connector to
>> be
>> advertiesed over rendezvous -->
>>      <transportConnector name="my.broker1" uri="tcp://localhost:61615"/>
>>      <!--<transportConnector name="PrintServer.broker1"
>> uri="tcp://localhost:61615"/>-->
>>    </transportConnectors>
>>
>>    <networkConnectors>
>>      <!-- by default just auto discover the other brokers -->
>>    <!--<networkConnector name="PrintServer.broker1"
>> uri="static://(tcp://localhost:61615)?jms.prefetchPolicy.all=30"/>-->
>>    <networkConnector name="my.broker1"
>> uri="static://(tcp://localhost:61615)?jms.prefetchPolicy.all"/>
>>      <!--
>>      <networkConnector
>> uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
>>      -->
>>    </networkConnectors>
>>
>>  </broker>
>>
>>
>> </beans>
>>
>>  The ra.xml :
>>
>> ...
>>  <resourceadapter>
>>
>>
>> <resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
>>        <config-property>
>>            <description>
>>              The URL to the ActiveMQ server that you want this connection
>> to connect to.  If using
>>              an embedded broker, this value should be 'vm://localhost'.
>>            </description>
>>            <config-property-name>ServerUrl</config-property-name>
>>            <config-property-type>java.lang.String</config-property-type>
>>
>> <!--<config-property-value>tcp://localhost:61615</config-property-value>-->
>>            <config-property-value>vm://localhost</config-property-value>
>>        </config-property>
>>        <config-property>
>>            <description>The default user name that will be used to
>> establish connections to the ActiveMQ server.</description>
>>            <config-property-name>UserName</config-property-name>
>>            <config-property-type>java.lang.String</config-property-type>
>>            <config-property-value>defaultUser</config-property-value>
>>        </config-property>
>>        <config-property>
>>            <description>The default password that will be used to log the
>> default user into the ActiveMQ server.</description>
>>            <config-property-name>Password</config-property-name>
>>            <config-property-type>java.lang.String</config-property-type>
>>            <config-property-value>defaultPassword</config-property-value>
>>        </config-property>
>>        <config-property>
>>            <description>The client id that will be set on the connection
>> that is established to the ActiveMQ server.</description>
>>            <config-property-name>Clientid</config-property-name>
>>            <config-property-type>java.lang.String</config-property-type>
>>        </config-property>
>>        <config-property>
>>            <description>Boolean to configure if outbound connections
>> should
>> reuse the inbound connection's session for sending
>> messages.</description>
>>            <config-property-name>UseInboundSession</config-property-name>
>>            <config-property-type>java.lang.Boolean</config-property-type>
>>            <config-property-value>false</config-property-value>
>>        </config-property>
>>
>>                          <!-- NOTE disable the following property if you
>> do
>> not wish to deploy
>> an embedded broker -->
>>        <config-property>
>>            <description>
>>              Sets the XML configuration file used to configure the
>> embedded
>> ActiveMQ broker via
>>              Spring if using embedded mode.
>>
>>              BrokerXmlConfig is the filename which is assumed to be on
>> the
>> classpath unless
>>              a URL is specified. So a value of foo/bar.xml would be
>> assumed
>> to be on the
>>              classpath whereas file:dir/file.xml would use the file
>> system.
>>              Any valid URL string is supported.
>>            </description>
>>            <config-property-name>BrokerXmlConfig</config-property-name>
>>            <config-property-type>java.lang.String</config-property-type>
>>
>> <config-property-value>xbean:broker-config.xml</config-property-value>
>>           </config-property>
>>
>>        <outbound-resourceadapter>
>>            <connection-definition>
>>
>>
>> <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
>>
>>
>> <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
>>
>>
>> <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
>>
>> <connection-interface>javax.jms.Connection</connection-interface>
>>
>>
>> <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
>>            </connection-definition>
>>            <connection-definition>
>>
>>
>> <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
>>
>>
>> <connectionfactory-interface>javax.jms.QueueConnectionFactory</connectionfactory-interface>
>>
>>
>> <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
>>
>> <connection-interface>javax.jms.QueueConnection</connection-interface>
>>
>>
>> <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
>>            </connection-definition>
>>            <connection-definition>
>>
>>
>> <managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
>>
>>
>> <connectionfactory-interface>javax.jms.TopicConnectionFactory</connectionfactory-interface>
>>
>>
>> <connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
>>
>> <connection-interface>javax.jms.TopicConnection</connection-interface>
>>
>>
>> <connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</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.apache.activemq.ra.ActiveMQActivationSpec</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>
>>        <adminobject>
>>            <adminobject-interface>javax.jms.Queue</adminobject-interface>
>>
>>
>> <adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
>>            <config-property>
>>                <config-property-name>PhysicalName</config-property-name>
>>
>> <config-property-type>java.lang.String</config-property-type>
>>            </config-property>
>>        </adminobject>
>>        <adminobject>
>>            <adminobject-interface>javax.jms.Topic</adminobject-interface>
>>
>>
>> <adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
>>            <config-property>
>>                <config-property-name>PhysicalName</config-property-name>
>>
>> <config-property-type>java.lang.String</config-property-type>
>>            </config-property>
>>        </adminobject>
>>    </resourceadapter>
>> ...
>>
>>  and finally the activemq-jms-ds.xml  (only the MBeans part) :
>>
>>   <mbean code="org.jboss.resource.deployment.AdminObject"
>> name="activemq.queue:name=QueueSingle">
>>      <attribute name="JNDIName">activemq/queue/QueueSingle</attribute>
>>      <depends
>>
>> optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
>>      <attribute name="Type">javax.jms.Queue</attribute>
>>      <attribute
>> name="Properties">PhysicalName=queue.QueueSingle</attribute>
>>   </mbean>
>>
>>    <mbean code="org.jboss.resource.deployment.AdminObject"
>> name="activemq.queue:name=QueueExpress">
>>      <attribute name="JNDIName">activemq/queue/QueueExpress</attribute>
>>      <depends
>>
>> optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
>>      <attribute name="Type">javax.jms.Queue</attribute>
>>      <attribute
>> name="Properties">PhysicalName=queue.QueueExpress</attribute>
>>   </mbean>
>>
>>    <mbean code="org.jboss.resource.deployment.AdminObject"
>> name="activemq.queue:name=QueueLPR">
>>      <attribute name="JNDIName">activemq/queue/QueueLPR</attribute>
>>      <depends
>>
>> optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
>>      <attribute name="Type">javax.jms.Queue</attribute>
>>      <attribute name="Properties">PhysicalName=queue.QueueLPR</attribute>
>>   </mbean>
>>
>>   <mbean code="org.jboss.resource.deployment.AdminObject"
>> name="activemq.topic:name=inboundTopic">
>>      <attribute name="JNDIName">activemq/topic/inbound</attribute>
>>      <depends
>>
>> optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
>>      <attribute name="Type">javax.jms.Topic</attribute>
>>      <attribute name="Properties">PhysicalName=topic.inbound</attribute>
>>   </mbean>
>>
>> so it does work, but when JBoss starts - it somehow tries to configure
>> the
>> Queue with
>> the XML configurations and it says - it's already registered!!!
>> what the ?!@#!
>>
>> The only way that I can see MY queue (in jconsole) and not "localhost"
>> queue
>> - is
>> to remove the <networkConnector> ( more so - not setting the connection
>> to
>> the same
>> broker defined in the <transportConnector>.
>> but my Queue isn't getting the configuration (nor does the localhost).
>>
>> So I don't know what I'm doing wrong !!!
>>
>> anyone who can share some info on the subject will be more then
>> appreciated
>> :)
>>
>> E.D :working:
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/PrefetchPolicy---more---all-not-working-when-embedding-ActiveMQ-into-JBoss-tp23616711p23616711.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> http://blog.garytully.com
> 
> Open Source SOA
> http://FUSESource.com
> 
> 

-- 
View this message in context: http://www.nabble.com/PrefetchPolicy---more---all-not-working-when-embedding-ActiveMQ-into-JBoss-tp23616711p23617818.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message