use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rocketmq-externals by apache.
the class RabbitMQPatternProcessor method connectionFactory.
public ConnectionFactory connectionFactory() {
RMQConnectionFactory connectionFactory = new RMQConnectionFactory();
try {
List<String> urlList = new ArrayList<>();
urlList.add(config.getBrokerUrl());
connectionFactory.setUris(urlList);
} catch (JMSException e) {
throw new DataConnectException(ErrorCode.START_ERROR_CODE, e.getMessage(), e);
}
return connectionFactory;
}
use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rocketmq-externals by apache.
the class RabbitmqSourceTaskTest method befores.
// @Before
public void befores() throws JMSException, InterruptedException {
RMQConnectionFactory connectionFactory = new RMQConnectionFactory();
connectionFactory.setUri("amqp://112.74.48.251:5672");
Connection connection = connectionFactory.createConnection("admin", "admin");
connection.start();
Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
Destination destination = session.createQueue("test-queue");
MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
for (int i = 0; i < 20; i++) {
TextMessage message = session.createTextMessage("hello 我是消息:" + i);
producer.send(message);
}
session.commit();
session.close();
connection.close();
}
use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rabbitmq-jms-client by rabbitmq.
the class PublisherConfirmsIT method init.
@BeforeEach
public void init() throws Exception {
ackedMessages.clear();
RMQConnectionFactory connectionFactory = (RMQConnectionFactory) AbstractTestConnectionFactory.getTestConnectionFactory().getConnectionFactory();
connectionFactory.setConfirmListener(context -> {
TextMessage textMessage = (TextMessage) context.getMessage();
try {
ackedMessages.put(textMessage.getText(), textMessage);
} catch (JMSException e) {
throw new RuntimeException(e);
}
});
connection = connectionFactory.createConnection();
connection.start();
}
use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rabbitmq-jms-client by rabbitmq.
the class RpcSpringJmsIT method setupRpcServer.
void setupRpcServer() throws Exception {
RMQConnectionFactory connectionFactory = (RMQConnectionFactory) AbstractTestConnectionFactory.getTestConnectionFactory().getConnectionFactory();
connectionFactory.setDeclareReplyToDestination(false);
serverConnection = connectionFactory.createConnection();
serverConnection.start();
Session session = serverConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue(QUEUE_NAME);
drainQueue(session, queue);
session.close();
rpcServer = new RpcServer(serverConnection);
}
use of com.rabbitmq.jms.admin.RMQConnectionFactory in project rabbitmq-jms-client by rabbitmq.
the class SSLHostnameVerificationIT method init.
@BeforeEach
public void init() {
cf = new RMQConnectionFactory();
cf.useSslProtocol(sslContext);
cf.setHostnameVerification(true);
}
Aggregations