Just to give some feedback and closure from my question a whole ago, I
ended up just using a JMS queue to message between the different contexts.
It worked fine, so thank you for letting me know that I should do things
another way.  Since the latest documentation describes how to use the VM
component to message between different contexts in the same JVM, someone
might want to update the documents to warn against this practice in certain
situations, if this truly is a bad practice.  Or maybe list the specific
situations where this is a decent solution, and advise that it should be
avoided in other situations.  Just my two cents, but maybe nobody else
would try it the way I did.

On Fri, Aug 7, 2020, 3:22 AM Claus Ibsen <claus.ib...@gmail.com> wrote:

> Hi
>
> You would need more JARs than just camel-core, such as camel-vm etc as
> well, and many others.
> And this is really IMHO a bad practice on tomcat to mess with
> classloading using this shared lib.
>
>
>
>
>
>
> On Thu, Aug 6, 2020 at 4:46 PM Steve973 <steve...@gmail.com> wrote:
> >
> > We have an application stack, deployed in Tomcat, that consists of
> several
> > Spring Boot applications. As part of our operations, we want to send some
> > messages to a vm endpoint, where a camel route will consume those
> messages
> > and then publish them to a JMS topic for any of the other Spring Boot
> > applications that are interested in messages on that topic.
> >
> > When I start the application stack, there are three spring boot apps that
> > utilize camel, and I see camel start properly in the logs. But when one
> of
> > the apps sends a message to the vm endpoint, the route that consumes from
> > that endpoint and routes the messages to the jms topic does not seem to
> get
> > that message. I have placed the camel-core jar in my tomcat lib
> directory.
> > In the spring boot maven plugin configuration, I have specified an
> > exclusion of the camel-core jar. Oddly enough, that jar is in the
> > WEB-INF/lib of the war anyway! So I have stopped Tomcat, removed that jar
> > from the exploded war, and restarted Tomcat, but that does not change the
> > behavior of the messaging.
> >
> > Here are the versions that we are using:
> >
> >    - Spring Boot 2.3.1
> >    - Camel 3.4.2
> >    - Tomcat 8.5.5
> >
> > The first spring boot app that links everything together, with the camel
> > route that consumes from the vm endpoint and produces that message on the
> > jms topic is our "routing engine". It uses camel-spring-boot-starter,
> > spring-boot-starter-artemis, camel-vm-starter, artemis-jms-server and
> > camel-jms-starter. Its RouteBuilder's configure method looks like this:
> >
> > from("vm:task")
> >     .log(LoggingLevel.WARN, "********** Received task message");
> >     .to("jms:topic:local.private.task")
> >     .routeId("taskToJms");
> >
> > The app that produces messages to the vm endpoint uses
> > camel-spring-boot-starter and camel-vm-starter. In that app, it has a
> > @Service class that receives a ProducerTemplate that is auto-wired in the
> > constructor. When the application invokes this component to send the
> > message, I see a line in the logs that says
> >
> > o.a.c.impl.engine.DefaultProducerCache (169) - >>>> vm://task Exchange[]
> >
> > so it appears that the message is being produced and sent properly to the
> > vm endpoint. However, I see no indication that it has been
> > received/consumed in the routing engine's camel route, since the route's
> > log line is not logging anything, and since I see no other indications of
> > receiving the message in the log. The strange thing is that I am not
> > getting the error of not having any consumers on the vm:task endpoint
> that
> > I was getting before I put the camel-core jar in tomcat's lib directory.
> >
> > Am I doing anything obviously wrong? How can I get the spring boot maven
> > plugin to really exclude camel-core? And why are the messages (sent to
> the
> > vm endpoint) not being consumed by the route in the routing engine?
> Thanks
> > in advance for any help.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Reply via email to