Skip to content

[ServiceBus] Track2 - Re-expose AMQP details on message #13297

@KieranBrantnerMagee

Description

@KieranBrantnerMagee

Given the ask to allow access to AMQP properties such as annotations and headers, there are two proposals at hand.

Proposal 1
Flat object.

Pros:

  • fewer new object concepts
  • less depth
  • all props immediately visible.

Cons:

  • all props immediately visible.
  • amqp/non-amqp confusion at top level
class PeekedMessage(Message):
    def __init__(self, message : AMQPMessage, ...):
        ...
        self.annotations = message.annotations # type: dict[str,str]
        self.headers = message.annotations # type: dict[str,str]
        ...

# accessed as:
message.annotations["foo"]="bar"

Sub-Proposal 1-B

As above, but amqp_[headers, annotations, etc] naming.

Proposal 2
AMQP sub-object. echoes the design of "ServiceBusReceiver.Session" for function-specific grouping if niche functionality.

Pros:

  • logical encapsulation, more communicative.
  • keeps core message surface area cleaner.

Cons:

  • additional layer of depth/additional concept.
  • if we ever introduce circular dependencies between these props, (e.g. A sets B, B sets A) it'll be problematic.
class AMQPMessageProperties(Object):
    def __init__(self, annotations, headers, ...)
        ...
        self.annotations = annotations # type: dict[str,str]
        self.headers = annotations  # type: dict[str,str]
        ...

class PeekedMessage(Message):
    def __init__(self, message : AMQPMessage, ...):
        ...
        self.amqp = AMQPMessageProperties(message.annotations, message.headers, ...) # type: AMQPMessageProperties
        ...

# accessed as:
message.amqp.annotations["foo"] = "bar"

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Service Bus

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions