I am trying to produce and send 1000s if not 10s of thousands of messages a 
second to an Artemis broker. My configure method is posted below. With this 
code I am able to send roughly 500 messages every 1.5 seconds, but I would like 
to speed this up. How would I go about speeding this up to reach 1000s of 
messages a second or better yet 10000 messages a second? . In the future, I 
would like to send an XML message where the payload changes slightly every 
message send, is there a "proper" way to implement these things?

As a note, If I increase my message send count to be greater than 500, I see a 
massive slow down from 1.5 seconds for 500 messages to 8 seconds for 1000 
messages. I suspect this has something to do with new connections being created 
or an individual thread being created for every message sent. I am not quite 
sure what I would need to do to fix this problem. Any thoughts on this would be 
greatly appreciated.

    @Override
    public void configure() throws Exception {

        CamelContext context = getContext();
        ActiveMQJMSConnectionFactory artemisConnection = new 
ActiveMQJMSConnectionFactory("tcp://malta.corp.sensis.com:32192"
                , "user", "pass");
        PooledConnectionFactory connectionFactory = new 
PooledConnectionFactory();
        connectionFactory.setConnectionFactory(artemisConnection);


        context.addComponent("Target",
                JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

        ProducerTemplate producer = context.createProducerTemplate();
        producer.setThreadedAsyncMode(true);
        //producer.setMaximumCacheSize(100000);

        from("timer:ticker?period=500")
                //.setBody()
                //.constant("Hello from SpringBoot")
                .process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
                        int messageSend = 500;



                        for ( int i = 0 ; i <messageSend; i++){
                            producer.sendBody("Target:queue:ProducerTestQueue", 
"Hi from Spring");
                            
//producer.asyncSendBody("Target:queue:ProducerTestQueue", "Hi from Spring");
                        }
                    }
                })
                .log(" 500 messages sent ");
    }
}


This message is intended only for the addressee and may contain information 
that is company confidential or privileged. Any technical data in this message 
may be exported only in accordance with the U.S. International Traffic in Arms 
Regulations (22 CFR Parts 120-130) or the Export Administration Regulations (15 
CFR Parts 730-774). Unauthorized use is strictly prohibited and may be 
unlawful. If you are not the intended recipient, or the person responsible for 
delivering to the intended recipient, you should not read, copy, disclose or 
otherwise use this message. If you have received this email in error, please 
delete it, and advise the sender immediately.

Reply via email to