superstreamlabs / memphis.py

Python client for Memphis. Memphis is an event processing platform
https://pypi.org/project/memphis-py/
Apache License 2.0
37 stars 21 forks source link

Inconsistent consumer name #175

Closed rnowling-memphis closed 1 year ago

rnowling-memphis commented 1 year ago

If using a callback, the consumer name is set to the consumer group:

consumer_group = get_internal_name(self.consumer_group)
self.psub = await self.connection.broker_connection.pull_subscribe(
    subject + ".final", durable=consumer_group
)

If using the fetch() method, the consumer name is set to the consumer group (if provided) or the consumer name:

if self.consumer_group != "":
    durable_name = get_internal_name(self.consumer_group)
else:
    durable_name = get_internal_name(self.consumer_name)
subject = get_internal_name(self.station_name)
self.psub = await self.connection.broker_connection.pull_subscribe(
    subject + ".final", durable=durable_name
)

And then the DLQ consumer does something completely differently:

subscription_name = "$memphis_dls_" + subject + "_" + consumer_group
self.consumer_dls = await self.connection.broker_manager.subscribe(
    subscription_name, subscription_name
)

It makes sense to me that if a consumer group isn't provided, then we use the consumer name as the consumer group. It's not clear to me, however, where we should be passing the consumer group.

rnowling-memphis commented 1 year ago

This has to do with differences in how normal messages versus dead letter messages are handled internally. This is expected behavior.