use of com.rabbitmq.http.client.Client in project spring-amqp by spring-projects.
the class FixedReplyQueueDeadLetterTests method testQueueArgs2.
@Test
void testQueueArgs2() throws MalformedURLException, URISyntaxException, InterruptedException {
Client client = new Client(brokerRunning.getAdminUri(), brokerRunning.getAdminUser(), brokerRunning.getAdminPassword());
QueueInfo queue = await().until(() -> client.getQueue("/", "all.args.2"), que -> que != null);
Map<String, Object> arguments = queue.getArguments();
assertThat(arguments.get("x-message-ttl")).isEqualTo(1000);
assertThat(arguments.get("x-expires")).isEqualTo(200_000);
assertThat(arguments.get("x-max-length")).isEqualTo(42);
assertThat(arguments.get("x-max-length-bytes")).isEqualTo(10_000);
assertThat(arguments.get("x-overflow")).isEqualTo("drop-head");
assertThat(arguments.get("x-dead-letter-exchange")).isEqualTo("reply.dlx");
assertThat(arguments.get("x-dead-letter-routing-key")).isEqualTo("reply.dlrk");
assertThat(arguments.get("x-max-priority")).isEqualTo(4);
assertThat(arguments.get("x-queue-mode")).isEqualTo("lazy");
assertThat(arguments.get(Queue.X_QUEUE_LEADER_LOCATOR)).isEqualTo(LeaderLocator.clientLocal.getValue());
}
use of com.rabbitmq.http.client.Client in project spring-amqp by spring-projects.
the class FixedReplyQueueDeadLetterTests method testQuorumArgs.
/*
* Does not require a 3.8 broker - they are just arbitrary arguments.
*/
@Test
void testQuorumArgs() throws MalformedURLException, URISyntaxException, InterruptedException {
Client client = new Client(brokerRunning.getAdminUri(), brokerRunning.getAdminUser(), brokerRunning.getAdminPassword());
QueueInfo queue = await().until(() -> client.getQueue("/", "test.quorum"), que -> que != null);
Map<String, Object> arguments = queue.getArguments();
assertThat(arguments.get("x-queue-type")).isEqualTo("quorum");
assertThat(arguments.get("x-delivery-limit")).isEqualTo(10);
}
use of com.rabbitmq.http.client.Client in project spring-amqp by spring-projects.
the class RabbitAdminTests method testLeaderLocator.
@Test
public void testLeaderLocator() throws Exception {
CachingConnectionFactory cf = new CachingConnectionFactory(RabbitAvailableCondition.getBrokerRunning().getConnectionFactory());
RabbitAdmin admin = new RabbitAdmin(cf);
AnonymousQueue queue = new AnonymousQueue();
admin.declareQueue(queue);
Client client = new Client("http://guest:guest@localhost:15672/api");
AnonymousQueue queue1 = queue;
QueueInfo info = await().until(() -> client.getQueue("/", queue1.getName()), inf -> inf != null);
assertThat(info.getArguments().get(Queue.X_QUEUE_LEADER_LOCATOR)).isEqualTo("client-local");
queue = new AnonymousQueue();
queue.setLeaderLocator(null);
admin.declareQueue(queue);
AnonymousQueue queue2 = queue;
info = await().until(() -> client.getQueue("/", queue2.getName()), inf -> inf != null);
assertThat(info.getArguments().get(Queue.X_QUEUE_LEADER_LOCATOR)).isNull();
cf.destroy();
}
use of com.rabbitmq.http.client.Client in project spring-amqp by spring-projects.
the class LocalizedQueueConnectionFactoryTests method doCreateClient.
private Client doCreateClient(String uri, String username, String password, String node) {
Client client = mock(Client.class);
QueueInfo queueInfo = new QueueInfo();
queueInfo.setNode(node);
given(client.getQueue("/", "q")).willReturn(queueInfo);
return client;
}
use of com.rabbitmq.http.client.Client in project spring-amqp by spring-projects.
the class BrokerRunningSupport method createQueues.
private Channel createQueues(Connection connection) throws IOException, URISyntaxException {
Channel channel;
channel = connection.createChannel();
for (String queueName : this.queues) {
if (this.purge) {
LOGGER.debug("Deleting queue: " + queueName);
// Delete completely - gets rid of consumers and bindings as well
channel.queueDelete(queueName);
}
if (isDefaultQueue(queueName)) {
// Just for test probe.
channel.queueDelete(queueName);
} else {
channel.queueDeclare(queueName, true, false, false, null);
}
}
if (this.management) {
Client client = new Client(getAdminUri(), this.adminUser, this.adminPassword);
if (!client.alivenessTest("/")) {
throw new BrokerNotAliveException("Aliveness test failed for localhost:15672 guest/quest; " + "management not available");
}
}
return channel;
}
Aggregations