Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8576199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:52:25+00:00 2026-06-11T19:52:25+00:00

I am relatively new to Camel and i’ve been struggling with a problem with

  • 0

I am relatively new to Camel and i’ve been struggling with a problem with a simple route that uses MyBatis to “feed” an ActiveMQ queue.

My route is as follows:

public class SearchItemProductionRouteRoute extends SpringRouteBuilder {
    @Override
    public void configure() throws Exception {
        from("timer://pollTheDatabase?delay=5000")
        .to("mybatis:selectSearchItem?statementType=SelectList&consumer.useIterator=true&consumer.onConsume=updateProcessingSearchItem")
        .to("bean:searchItemProcesser?method=process")
        .to("activemq:searchitemqueue");
    }
} 

The mybatis query is working fine. The query itself brings 4 records from the database. My need is that each row should become a message in the queue, but instead, i get 1 message with all the 4 rows in it.

The searchItemProcessor just prints de body of the message (thats how i know that the message contains all 4 records).

These are the queries that the above route uses:

<select id="selectSearchItem" resultMap="result" parameterType="java.util.HashMap">
    SELECT * FROM SEARCH_REQUEST_ITEM SRI WHERE SRI.STATUS = '1' 
</select>

<update id="updateProcessingSearchItem">
    UPDATE SEARCH_REQUEST_ITEM SET STATUS = 2,   
    UPDATEDIN=SYSDATE, UPDATEDBY='XDRBATCH' 
    WHERE ID = #{ID}
</update>

If anyone can shed some light over this i’ll be thankful!

EDIT:

Just found one workaround using the Splitter EIP. First i created this class:

public class XdrMessageSplitterBean {
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public List<HashMap> splitBody(Object body) {
        return (List<HashMap>) body;
    }
}

Then add it to the route:

    public void configure() throws Exception {
        from("timer://pollTheDatabase?delay=5000")
        .to("mybatis:selectSearchItem?statementType=SelectList&consumer.useIterator=true&consumer.onConsume=updateProcessingSearchItem")
        .split().method("xdrMessageSplitterBean", "splitBody")
        .to("bean:searchItemProcesser?method=process")
        .to("activemq:searchitemqueue");
    }

The bean must be declared in the camel-context.xml file:

    <bean id="xdrMessageSplitterBean" name="xdrMessageSplitterBean"
    class="package.of.bean.XdrMessageSplitterBean" />

It works, but does not feel right. If anyone has any suggestion it will be very welcomed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:52:26+00:00Added an answer on June 11, 2026 at 7:52 pm

    You can consume from mybatis directly, and specify the polling frequency. You dont need the timer for that. There is a delay option you can use to set = 5000 for 5 seconds frequency.

    public void configure() throws Exception {
            from("mybatis:selectSearchItem?statementType=SelectList&consumer.useIterator=true&consumer.onConsume=updateProcessingSearchItem&delay=5000")
            .split().method("xdrMessageSplitterBean", "splitBody")
            .to("bean:searchItemProcesser?method=process")
            .to("activemq:searchitemqueue");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Relatively new to rails, I'm working on a simple rails app for a few
I'm relatively new at PHP and came across a slight problem. I have a
Relatively new to python. I recently posted a question in regards to validating that
I'm relatively new to ruby and i came from php. One thing that it
I am relatively new to C#/.Net. I'm developing a desktop application that requires multi
I want to develop a relatively simple application that calculates some value based on
Being relatively new to backbone.js, I've created several small tests from a simple model
Relatively new to rails and trying to model a very simple family tree with
Relatively new to JavaScript, so wondering what is the best approach to achive the
Relatively new to WinForms but I'm working on a small business app. Anyway, where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.