use of com.rabbitmq.http.client.domain.QueueInfo in project spring-amqp by spring-projects.
the class FixedReplyQueueDeadLetterTests method testQueueArgs1.
@Test
void testQueueArgs1() throws MalformedURLException, URISyntaxException, InterruptedException {
Client client = new Client(brokerRunning.getAdminUri(), brokerRunning.getAdminUser(), brokerRunning.getAdminPassword());
QueueInfo queue = await().until(() -> client.getQueue("/", "all.args.1"), 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("reject-publish");
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.minLeaders.getValue());
assertThat(arguments.get("x-single-active-consumer")).isEqualTo(Boolean.TRUE);
}
use of com.rabbitmq.http.client.domain.QueueInfo 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.domain.QueueInfo 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.domain.QueueInfo 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.domain.QueueInfo 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;
}
Aggregations