javax.jms.QueueSession.createConsumer()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中javax.jms.QueueSession.createConsumer方法的一些代码示例,展示了QueueSession.createConsumer的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueueSession.createConsumer方法的具体详情如下:
包路径:javax.jms.QueueSession
类名称:QueueSession
方法名:createConsumer

QueueSession.createConsumer介绍

暂无

代码示例

代码示例来源:origin: apache/activemq

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector, noLocal);
}

代码示例来源:origin: apache/activemq

@Override
public MessageConsumer createConsumer(Destination destination) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination);
}

代码示例来源:origin: apache/activemq

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public JMSQueueSink(String qcfBindingName, String queueBindingName,
  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);
  QueueConnectionFactory queueConnectionFactory;
  queueConnectionFactory = (QueueConnectionFactory) lookup(ctx,
    qcfBindingName);
  System.out.println("Queue Cnx Factory found");
  Queue queue = (Queue) ctx.lookup(queueBindingName);
  System.out.println("Queue found: " + queue.getQueueName());
  QueueConnection queueConnection = queueConnectionFactory
    .createQueueConnection(username, password);
  System.out.println("Queue Connection created");
  
  QueueSession queueSession = queueConnection.createQueueSession(false,
    Session.AUTO_ACKNOWLEDGE);
  MessageConsumer queueConsumer = queueSession.createConsumer(queue);
  queueConsumer.setMessageListener(this);
  
  queueConnection.start();
  System.out.println("Queue Connection started");
  
 } catch (Exception e) {
  logger.error("Could not read JMS message.", e);
 }
}

代码示例来源:origin: org.apache.activemq/activemq-client

@Override
public MessageConsumer createConsumer(Destination destination) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination);
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector, noLocal);
}

代码示例来源:origin: pierre/meteo

/**
 * @param destination
 * @param messageSelector
 * @return
 * @throws JMSException
 */
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector);
}

代码示例来源:origin: pierre/meteo

/**
 * @param destination
 * @return
 * @throws JMSException
 */
public MessageConsumer createConsumer(Destination destination) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination);
}

代码示例来源:origin: org.apache.activemq/activemq-client

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector);
}

代码示例来源:origin: org.apache.activemq/activemq-client

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector, noLocal);
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector, noLocal);
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public MessageConsumer createConsumer(Destination destination) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination);
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector);
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector);
}

代码示例来源:origin: pierre/meteo

/**
 * @param destination
 * @param messageSelector
 * @param noLocal
 * @return
 * @throws JMSException
 */
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination, messageSelector, noLocal);
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
public MessageConsumer createConsumer(Destination destination) throws JMSException {
  if (destination instanceof Topic) {
    throw new InvalidDestinationException("Topics are not supported by a QueueSession");
  }
  return next.createConsumer(destination);
}

代码示例来源:origin: io.skullabs.uworkers/uworkers

@Override
  MessageConsumer createMessageConsumer() {
    try {
      return currentSession().createConsumer(destination());
    } catch (final JMSException cause) {
      throw new RuntimeException(cause);
    }
  }
}

代码示例来源:origin: apache/chukwa

private void initializeQueue(Connection connection,
                  String topic,
                  String selector,
                  JMSListener listener) throws JMSException {
 QueueSession session = ((QueueConnection)connection).
     createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
 Queue queue = session.createQueue(topic);
 MessageConsumer consumer = session.createConsumer(queue, selector, true);
 consumer.setMessageListener(listener);
}

代码示例来源:origin: hibernate/hibernate-search

private void registerMessageListener() throws Exception {
  MessageConsumer consumer = getQueueSession().createConsumer( getMessageQueue() );
  consumer.setMessageListener( new SearchQueueChecker( getExtendedSearchIntegrator() ) );
}

代码示例来源:origin: hibernate/hibernate-search

private void registerMessageListener() throws Exception {
  MessageConsumer consumer = getQueueSession().createConsumer( getMessageQueue() );
  consumer.setMessageListener( new MDBSearchController( getExtendedSearchIntegrator() ) );
}

相关文章