merlimat commented on a change in pull request #86: Simplify and refactor parts
of the single topic consumer.
URL: https://github.com/apache/pulsar-client-go/pull/86#discussion_r344854885
##########
File path: pulsar/consumer.go
##########
@@ -139,46 +141,15 @@ type Consumer interface {
// This calls blocks until a message is available.
Receive(context.Context) (Message, error)
- // ReceiveAsync appends the message to the msgs channel asynchronously.
- ReceiveAsync(ctx context.Context, msgs chan<- ConsumerMessage) error
-
- // ReceiveAsyncWithCallback returns a callback containing the message
and error objects
- ReceiveAsyncWithCallback(ctx context.Context, callback func(msg
Message, err error))
+ // Messages returns a channel to consumer messages from
+ Messages() <-chan ConsumerMessage
// Ack the consumption of a single message
Ack(Message) error
// AckID the consumption of a single message, identified by its
MessageID
AckID(MessageID) error
- // AckCumulative the reception of all the messages in the stream up to
(and including) the provided message.
- // This method will block until the acknowledge has been sent to the
broker. After that, the messages will not be
- // re-delivered to this consumer.
- //
- // Cumulative acknowledge cannot be used when the consumer type is set
to ConsumerShared.
- //
- // It's equivalent to calling asyncAcknowledgeCumulative(Message) and
waiting for the callback to be triggered.
- AckCumulative(Message) error
-
- // AckCumulativeID the reception of all the messages in the stream up
to (and including) the provided message.
- // This method will block until the acknowledge has been sent to the
broker. After that, the messages will not be
- // re-delivered to this consumer.
- // Cumulative acknowledge cannot be used when the consumer type is set
to ConsumerShared.
- // It's equivalent to calling asyncAcknowledgeCumulative(MessageID) and
waiting for the callback to be triggered.
- AckCumulativeID(MessageID) error
-
// Close the consumer and stop the broker to push more messages
Close() error
-
- // Seek reset the subscription associated with this consumer to a
specific message id.
- // The message id can either be a specific message or represent the
first or last messages in the topic.
- // Note: this operation can only be done on non-partitioned topics. For
these, one can rather perform the
- // seek() on the individual partitions.
- Seek(msgID MessageID) error
Review comment:
I'd leave the `Seek()` operation on, since this is commonly used by apps.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services