Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EventHub] only amqp annotated message #19287

Merged
merged 15 commits into from
Jun 29, 2021

Conversation

swathipil
Copy link
Member

fixes: #18677

@ghost ghost added the Event Hubs label Jun 17, 2021
@swathipil swathipil marked this pull request as draft June 17, 2021 01:24
Copy link
Contributor

@yunhaoling yunhaoling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to pull up ContentType, MesssageId and CorrelationId as top level properties on EventData

:rtype: None
:raise: :class:`ValueError`, when exceeding the size limit.
"""
# pylint:disable=protected-access
if isinstance(event_data, AmqpAnnotatedMessage):
event_data = EventData._from_message(event_data._to_outgoing_amqp_message()) # pylint: disable=protected-access
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to add the _to_outgoing_message on AmqpAnnotatedMessage like what we have done in Service Bus?

https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/servicebus/azure-servicebus/azure/servicebus/amqp/_amqp_message.py#L296-L298

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I didn't add it because in the SB AmqpAnnotatedMessage _to_outgoing_message, you send in the message arg into ServiceBusMessage. However, EventData does not take keyword args, so we cannot pass in message. If we wanted to do this, we would need to allow for an optional message property on EventData and change the API. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we ultimately would need the kwargs in the constructor.

I'm checking the design guideline

DO craft a constructor for models that are intended to be instantiated by a user (i.e. non-result types) with minimal required information and optional information as keyword-only arguments.

We're missing it in EventData (e.g. properties could be keyword argument in the constructor), but that's a different topic.

I'm good with leaving as it is now as it's an implementation detail, I feel adding kwargs to the constructor while users could not pass anything and there being no documentation is not friendly.

@annatisch , what about your opinions?

@swathipil
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil
Copy link
Member Author

swathipil commented Jun 24, 2021

/azp run python - eventhub - tests

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@yunhaoling yunhaoling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me overall, let some minor comments
don't forget to generate an apiview for our arch to review :)

@swathipil swathipil marked this pull request as ready for review June 25, 2021 18:39
@swathipil
Copy link
Member Author

/azp run python - eventhub - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil
Copy link
Member Author

swathipil commented Jun 25, 2021

/azp run python - eventhub - tests

@Azure Azure deleted a comment from azure-pipelines bot Jun 25, 2021
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@yunhaoling yunhaoling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@swathipil swathipil merged commit 024e007 into Azure:main Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EventHubs] Support for AMQPAnnotatedMessage
2 participants