Skip to content

PubSub : add AckReplyConsumer to PubsubMessage #3852

@dhoard

Description

@dhoard

Currently for asynchronous subscribers, they must implement MessageReceiver ...

Current interface ...

public interface MessageReceiver {
    void receiveMessage(final PubsubMessage message, final AckReplyConsumer consumer);
}

The decoupling of PubsubMessage and AckReplyConsumer for this interface provides no benefit to developers and requires another object to contain both AckReplyConsumer and PubsubMessage for easy processing, etc.

New interface ...

public interface MessageReceiver {
    void receiveMessage(final PubsubMessage message);
}

AckReplyConsumer then can be retrieved from a PubsubMessage via a new method getAckReplyConsumer().

This provides a cleaner interface contract and allows a developer to dispatch the PubsubMessage to various handler methods as a single object.

An an even cleaner alternative would be to add the ack() and nack() methods to the PubsubMessage and remove the AckReplyConsumer altogether, which is the approach that spring-cloud-gcp has taken.

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions