7 Replies Latest reply on Feb 5, 2015 10:53 AM by igarashitm

    One unique data instance


      Hello guys,

      lets imagine i have a scheduling task which runs once and gets some data from DB how and where can i put this data so that in every camel route i can have access to this data?



        • 1. Re: One unique data instance

          In the message body or context headers. How are you reading from the DB? Usually this will get the data into the message body.

          • 2. Re: One unique data instance

            Why don't you just run a camel route directly from the scheduler every time you get data from DB? Once you put it somewhere outside of transaction, the data consistency would be lost.

            • 3. Re: One unique data instance


              As per jmorales he says that "as a request is synchronous, the data that you read from the DB gets lost, no matter what you use (context, body) after you have processed that request"



              Sounds like i must use cache. Was checking in infinispan and was trying to add was tring to add <to uri="infinispan://localhost?cacheContainer=#cacheContainer&amp;caseName=orders"/> to my route but i got the bellow exception:

              Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: infinispan://localhost?cacheContainer=%23cacheContainer&caseName=orders due to: No component found with scheme: infinispan


              Any idea what is missing?



              • 4. Re: One unique data instance

                camel-infinispan is not directly supported in SwitchYard. You need to create the extension by yourself.

                Extensions - SwitchYard - Project Documentation Editor

                • 5. Re: One unique data instance

                  Oh ok. Thanks for the input Tomohisa!


                  Any idea on when it will be fully supported?

                  What other cache alternatives do i have?

                  • 6. Re: One unique data instance


                    as I mentioned in the irc, you can use Infinispan in Java (in a Java component) or a Java processor (in a camel component) if the infinispan camel component gets complicated to you. It should be very simple to create, and you should find some examples on how to use Infinispan from java in a EE world.



                    • 7. Re: One unique data instance

                      Unfortunately we don't have a plan to support camel-infinispan right now. AFAIK JBoss Fuse doesn't yet support camel-infinispan as well. If you have a subscription for FSW, you may want to file a feature request through the customer support. But IMO still infinispan is a first option for on-memory cache as its jar is already in the distribution.