Skip to content

Rejected status returned when publishing but message is successfully published to queue #66

Closed

Description

@geniqtech

Describe the bug

Hi! Was trying out this new AMQP 1.0 java client. Following the guide, here's my simple code to publish a single message to queue.

try (Environment environment = new AmqpEnvironmentBuilder().build(); Connection connection = getConnection(environment)) {
	Publisher publisher = connection.publisherBuilder()
			.exchange("outgoing").key("test")
			.build();

	Message message = publisher.message("This is a test message".getBytes(StandardCharsets.UTF_8));

	publisher.publish(message, context -> {
		if (context.status() == Publisher.Status.ACCEPTED) {
			logger.info("Success");
		} else {
			logger.error("Failed to publish message [Status={}]", context.status());
		}
	});

	publisher.close();

} catch (Exception e) {
	logger.error(Constants.LOG_EXCEPTION, method, e.getMessage());
}

When I ran the code, I can see the following output:
Client Log:

Connection ID:8765abde-1168-4aad-8732-7667afe75744:1:1 connected to server: 192.168.100.188:5672
Failed to publish message [Status=REJECTED]

Server Log:

2024-09-26 11:31:39.978578+08:00 [info] <0.82262.0> accepting AMQP connection 192.168.100.88:5496 -> 192.168.100.188:5672
2024-09-26 11:31:40.026375+08:00 [info] <0.82262.0> Connection from AMQP 1.0 container 'ID:8765abde-1168-4aad-8732-7667afe75744:1:1': user 'xxx' authenticated using SASL mechanism PLAIN and granted access to vhost '/'
2024-09-26 11:31:40.084173+08:00 [info] <0.82262.0> closing AMQP connection (192.168.100.88:5496 -> 192.168.100.188:5672, duration: '120ms')

Reproduction steps

...

Expected behavior

Publish status should be ACCEPTED instead of REJECTED

Additional context

Test RabbitMQ cluster with 3 nodes using quorum based queues.
Erlang v26.2.5.3
RabbitMQ v4.0.2

Activity

  1. added
    bug
    on Sep 26, 2024
  2. locked and limited conversation to collaborators on Sep 26, 2024
  3. converted this issue into a discussion #67 on Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions