Note that there are some explanatory texts on larger screens.

plurals
  1. POSlow HornetQ Producer when Queue is persistent
    primarykey
    data
    text
    <p>I have tried with Persistent Queue in horntQ. I have made two separate examples (Producer, Consumer). My consumer is working well but the Producer is taking too much time to finish sending message. I have run both separately as well as together. What could be the problem? my code is: </p> <pre><code>public class HornetProducer implements Runnable{ Context ic = null; ConnectionFactory cf = null; Connection connection = null; Queue queue = null; Session session = null; MessageProducer publisher = null; TextMessage message = null; int messageSent=0; public synchronized static Context getInitialContext()throws javax.naming.NamingException { Properties p = new Properties( ); p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); p.put(Context.URL_PKG_PREFIXES," org.jboss.naming:org.jnp.interfaces"); p.put(Context.PROVIDER_URL, "jnp://localhosts:1099"); return new javax.naming.InitialContext(p); } public HornetProducer()throws Exception{ ic = getInitialContext(); cf = (ConnectionFactory)ic.lookup("/ConnectionFactory"); queue = (Queue)ic.lookup("queue/testQueue2"); connection = cf.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); publisher = session.createProducer(queue); connection.start(); } public void publish(){ try{ message = session.createTextMessage("Hello!"); System.out.println("StartDate: "+new Date()); for(int i=0;i&lt;10000;i++){ messageSent++; publisher.send(message); } System.out.println("EndDate: "+new Date()); }catch(Exception e){ System.out.println("Exception in Consume: "+ e.getMessage()); } } public void run(){ publish(); } public static void main(String[] args) throws Exception{ new HornetProducer().publish(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload