/** * @param topic * @return * @throws JMSException */ public TopicSubscriber createSubscriber(Topic topic) throws JMSException { return next.createSubscriber(topic); }
/** * @param topic * @param messageSelector * @param noLocal * @return * @throws JMSException */ public TopicSubscriber createSubscriber(Topic topic, String messageSelector, boolean noLocal) throws JMSException { return next.createSubscriber(topic, messageSelector, noLocal); }
public JMSSink( String tcfBindingName, String topicBindingName, String username, String password) { try { Context ctx = new InitialContext(); TopicConnectionFactory topicConnectionFactory; topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, tcfBindingName); TopicConnection topicConnection = topicConnectionFactory.createTopicConnection(username, password); topicConnection.start(); TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = (Topic)ctx.lookup(topicBindingName); TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic); topicSubscriber.setMessageListener(this); } catch(JMSException e) { logger.error("Could not read JMS message.", e); } catch(NamingException e) { logger.error("Could not read JMS message.", e); } catch(RuntimeException e) { logger.error("Could not read JMS message.", e); } }
@Override public TopicSubscriber createSubscriber(Topic topic) throws JMSException { checkTopicSession(); TopicSession ts = (TopicSession) delegate; return TracingMessageConsumer.create(ts.createSubscriber(topic), jmsTracing); }
@Override public TopicSubscriber createSubscriber(Topic topic, String messageSelector, boolean noLocal) throws JMSException { checkTopicSession(); TopicSession ts = (TopicSession) delegate; return TracingMessageConsumer.create(ts.createSubscriber(topic, messageSelector, noLocal), jmsTracing); }
@Override protected MessageConsumer createConsumer() throws JMSException { // set up the consumer if (consumerConnection == null) return null; consumerSession = consumerConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE); MessageConsumer consumer = null; if (consumerName != null && consumerName.length() > 0) { if (selector != null && selector.length() > 0) { consumer = consumerSession.createDurableSubscriber(consumerTopic, consumerName, selector, false); } else { consumer = consumerSession.createDurableSubscriber(consumerTopic, consumerName); } } else { if (selector != null && selector.length() > 0) { consumer = consumerSession.createSubscriber(consumerTopic, selector, false); } else { consumer = consumerSession.createSubscriber(consumerTopic); } } consumer.setMessageListener(this); return consumer; }
/** Constructor for the {@code TopicRequestor} class. * * <P>This implementation assumes the session parameter to be non-transacted, * with a delivery mode of either {@code AUTO_ACKNOWLEDGE} or * {@code DUPS_OK_ACKNOWLEDGE}. * * @param session the {@code TopicSession} the topic belongs to * @param topic the topic to perform the request/reply call on * * @exception JMSException if the JMS provider fails to create the * {@code TopicRequestor} due to some internal * error. * @exception InvalidDestinationException if an invalid topic is specified. */ public TopicRequestor(TopicSession session, Topic topic) throws JMSException { if (topic==null) throw new InvalidDestinationException("topic==null"); this.session = session; tempTopic = session.createTemporaryTopic(); publisher = session.createPublisher(topic); subscriber = session.createSubscriber(tempTopic); }
public JMSTopicSink(String tcfBindingName, String topicBindingName, String username, String password) { try { Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); env.put(Context.PROVIDER_URL, "tcp://localhost:61616"); Context ctx = new InitialContext(env); TopicConnectionFactory topicConnectionFactory; topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, tcfBindingName); System.out.println("Topic Cnx Factory found"); Topic topic = (Topic) ctx.lookup(topicBindingName); System.out.println("Topic found: " + topic.getTopicName()); TopicConnection topicConnection = topicConnectionFactory .createTopicConnection(username, password); System.out.println("Topic Connection created"); TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic); topicSubscriber.setMessageListener(this); topicConnection.start(); System.out.println("Topic Connection started"); } catch (Exception e) { logger.error("Could not read JMS message.", e); } }
public JMSSink( String tcfBindingName, String topicBindingName, String username, String password) { try { Context ctx = new InitialContext(); TopicConnectionFactory topicConnectionFactory; topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, tcfBindingName); TopicConnection topicConnection = topicConnectionFactory.createTopicConnection(username, password); topicConnection.start(); TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = (Topic)ctx.lookup(topicBindingName); TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic); topicSubscriber.setMessageListener(this); } catch(JMSException e) { logger.error("Could not read JMS message.", e); } catch(NamingException e) { logger.error("Could not read JMS message.", e); } catch(RuntimeException e) { logger.error("Could not read JMS message.", e); } }
public TopicRequestor(TopicSession session, Topic topic) throws JMSException { super(); setSession(session); setTopic(topic); setTemporaryTopic(session.createTemporaryTopic()); setPublisher(session.createPublisher(topic)); setSubscriber(session.createSubscriber(getTemporaryTopic())); }
private TopicSubscriber createSubscriber(TopicSession session, Topic topic, String messageSelector, boolean noLocal) throws JMSException { return session.createSubscriber(topic, messageSelector, noLocal); }
private TopicSubscriber createSubscriber(TopicSession session, Topic topic, String messageSelector, boolean noLocal) throws JMSException { return session.createSubscriber(topic, messageSelector, noLocal); }
/** * @param topic * @return * @throws JMSException */ public TopicSubscriber createSubscriber(Topic topic) throws JMSException { return next.createSubscriber(topic); }
/** * @param topic * @param messageSelector * @param noLocal * @return * @throws JMSException */ public TopicSubscriber createSubscriber(Topic topic, String messageSelector, boolean noLocal) throws JMSException { return next.createSubscriber(topic, messageSelector, noLocal); }
/** * @param topic * @return * @throws JMSException */ public TopicSubscriber createSubscriber(Topic topic) throws JMSException { return next.createSubscriber(topic); }
public TopicSubscriber createSubscriber(Topic topic, String selector, boolean local) throws JMSException { return ((TopicSession)getActualSession()).createSubscriber(topic, selector, local); }
public void run(String dest) throws Exception { InitialContext ic = getInitialContext(); TopicConnectionFactory confac = (TopicConnectionFactory) ic.lookup("ConnectionFactory"); TopicConnection connection = confac.createTopicConnection(); TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic(dest); TopicSubscriber topicSubscriber = session.createSubscriber(topic); topicSubscriber.setMessageListener(this); System.out.println("MDD-Consumer listening for topic : "+topic.getTopicName()); connection.start(); } public void onMessage(Message message){
public TopicRequestor(TopicSession session, Topic topic) throws JMSException { super(); setSession(session); setTopic(topic); setTemporaryTopic(session.createTemporaryTopic()); setPublisher(session.createPublisher(topic)); setSubscriber(session.createSubscriber(getTemporaryTopic())); }
public TopicRequestor(TopicSession session, Topic topic) throws JMSException { super(); setSession(session); setTopic(topic); setTemporaryTopic(session.createTemporaryTopic()); setPublisher(session.createPublisher(topic)); setSubscriber(session.createSubscriber(getTemporaryTopic())); }
public TopicRequestor(TopicSession session, Topic topic) throws JMSException { super(); setSession(session); setTopic(topic); setTemporaryTopic(session.createTemporaryTopic()); setPublisher(session.createPublisher(topic)); setSubscriber(session.createSubscriber(getTemporaryTopic())); }