private void startConsumers() { HedwigConnectionFactoryImpl connFactory = new HedwigConnectionFactoryImpl(); Connection conn; try { conn = connFactory.createConnection(userName, password); conn.start(); for (int i = 0; i < consumerCount; i++) { ConsumerThread th = new ConsumerThread(conn, "ConsumerThread" + i); th.start(); } } catch (JMSException e) { logger.error("Failed to start consumers", e); } }
public ProducerThread(HedwigConnectionFactoryImpl connFactory, int count, String name) { super(); this.count = count; this.setName(name); logger.trace("Created new producer thread:" + name); try { conn = connFactory.createConnection(); conn.start(); session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(dest); } catch (JMSException e) { logger.error("Failed to start producer thread:" + name, e); } }