On 3/7/07, James Strachan <[EMAIL PROTECTED]> wrote:
The Spring jars are not mandatory, you can use ActiveMQ just fine without it. Currently main use of Spring is along with xbean to deal with the XML configuration. If you prefer you could just use Java code to initialise your broker... http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html
Hi After some problems I decided to erase Spring from my service and configure ActiveMQ in my java code but I found that docs show the obvious and help nothing with the rest. In my xml I have: ---------------- <broker xmlns="http://activemq.org/config/1.0" brokerName="MASTERUBUNTU" persistent="true" useJmx="true"> <!-- Use the following to configure how ActiveMQ is exposed in JMX --> <managementContext> <managementContext connectorPort="2011" jmxDomainName="org.apache.activemq"/> </managementContext> <persistenceAdapter> <journaledJDBC journalLogFiles="5" dataDirectory="activemq-data"/> </persistenceAdapter> <transportConnectors> <transportConnector uri="tcp://172.31.112.9:62002" /> </transportConnectors> <networkConnectors> <networkConnector uri="static://(tcp://172.31.112.9:62003,tcp://172.31.27.1:62012,tcp://172.30.27.1:62014)" failover="true" dynamicOnly="true" /> </networkConnectors> </broker> --------------- Then I did a properties file as follows: --------------- brokerName=MASTERUBUNTU transportConnector=tcp://172.31.112.9:62002 networkConnector=static://(tcp://172.31.112.9:62003,tcp://172.31.27.1:62012,tcp://172.30.27.1:62014) --------------- that I load when my service init and try to configure my broker as follows: service = new BrokerService(); service.setBrokerName(masterBrokerProps. getProperty("brokerName")); service.setPersistent(true); service.addConnector(masterBrokerProps. getProperty("transportConnector")); Now, first problem: service.addNetworkConnector(masterBrokerProps. getProperty("networkConnector")); Is this ok or should I define many adds for each network connection ? How could I define failover and dynamicOnly ? Next problem, I want to define the persistence adapter: After reading docs I know that can make it with something like this PersistenceAdapter pa = new JournalPersistenceAdapter(); service.setPersistenceAdapter(pa); But I don't know which parameters should I pass. Constructor ask me for: 1 - org.apache.activeio.journal.Journal journal: Should I define a new JournalImpl with the directory name I defined in my xml ? 2 - PersistenceAdapter longTermPersistence, What should I define here ? 3 - TaskRunnerFactory taskRunnerFactory I guess a new TaskRunnerFactory () is enough here. Am I right ? Also, how should I set my xml management context settings ? I guess there are few explanations in docs for the quantity of settings needed in a real broker definition. Hope someone could clarify this matter. Thanks in advance J