The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

newbie000 (10) [Avatar] Offline
#1
on page 27 of the book it says "ActiveMQ creates a broker on demand if one isn’t running already". Do I need to install and run ActiveMQ to pass the file to "incomingOrders" queue?

While I was going through the example, I started ActiveMQ (thinking that it is required) and then ran the example, I was able to see the following message: "We just downloaded: message1.xml" . Then I stopped the ActiveMQ and ran the same example again, I was still able to see the message "We just downloaded: message1.xml"

I am now confused. Does CAMEL has a builtin to ActiveMQ broker? How can I go to the "incomingOrders" queue and see that the file/message has indeed being moved to the queue?
janstey (72) [Avatar] Offline
#2
Re: ActiveMQ creates a broker on demand if one isn’t running already
When the VM transport is used to connect to ActiveMQ, the first to connect will start up an embedded ActiveMQ broker. All following connections within the same JVM will connect to this embedded broker. If you booted ActiveMQ up in a separate process and ran the example, it is likely that a 2nd ActiveMQ broker was created in the VM (so you didn't actually connect to the one you started manually).

If you want to connect to the broker to see queue stats, I would recommend starting up ActiveMQ manually like you did initially and connect to it using the TCP transport like so

<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
</property>
</bean>

Then you can look at the JMS queue contents using jconsole or the ActiveQM web console http://activemq.apache.org/web-console.html

Cheers,
Jon
newbie000 (10) [Avatar] Offline
#3
Re: ActiveMQ creates a broker on demand if one isn’t running already
Thank you for the explanation.
I am still not 100% clear. I'll apprecaite, if you could explain the following:

1. Where does the embedded broker come from? I am simply tyring examples in the book. Examples use MAVEN so I don't know what is downloaded by MAVEN when an example is run. I ran an example on page 38:

"Go to the chapter2/spring directory in the book’s source code and run this Maven command: mvn clean compile camel:run"

The example ran successfully. My confusion is how is

1. How is ACTIVEMQ broker downloaded. Is the ACTIVEMQ downloaded and configured by MAVEN
2. I don't have SPRING installed on my machine. How are all the SPRING classes downloaded. Will every project download the SPRING files?
3. I don't understand what is going on when MAVEN is run. Please explain what magic down by MAVEN.

Thank you
davsclaus (413) [Avatar] Offline
#4
Re: ActiveMQ creates a broker on demand if one isn’t running already
Yes Maven downloads the needed JARs automatic.

You can run a maven command that lists all the dependencies it uses
mvn dependency:list

And there is a tree variant
mvn dependency:tree