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

CloudEvent should magically recognize dict's from known services #19247

Closed
rakshith91 opened this issue Jun 14, 2021 · 2 comments · Fixed by #19922
Closed

CloudEvent should magically recognize dict's from known services #19247

rakshith91 opened this issue Jun 14, 2021 · 2 comments · Fixed by #19922
Assignees
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. Event Grid Messaging Messaging crew P0
Milestone

Comments

@rakshith91
Copy link
Contributor

rakshith91 commented Jun 14, 2021

While the current implementation of the from_dict in cloud event is round trippable, the from_dict does not work with known services.

In other words, this should not break:

with event_hub_client:
    with receiver:
        for msg in receiver:
            batch = event_hub_client.create_batch()
            batch.add(EventData(f"Receiving messages..."))
            event = CloudEvent.from_dict(
                json.loads(str(msg))
            )
@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 14, 2021
@rakshith91 rakshith91 self-assigned this Jun 14, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 14, 2021
@rakshith91 rakshith91 added this to the [2021] July milestone Jun 14, 2021
@jongio
Copy link
Member

jongio commented Jun 21, 2021

I would like to see us create something more intuitive than this:

event = CloudEvent.from_dict(
                json.loads(str(msg))
            )

Something like this:

event = CloudEvent.from_str(msg)

azsdke2e
azsdke2e2

@rakshith91 rakshith91 changed the title CloudEvent should magically recognize dict's from known services CloudEvent should throw a proper message when sent wrong event schema Jun 22, 2021
@rakshith91 rakshith91 changed the title CloudEvent should throw a proper message when sent wrong event schema CloudEvent should magically recognize dict's from known services Jun 23, 2021
@rakshith91 rakshith91 modified the milestones: [2021] July, [2021] August Jun 23, 2021
@lmazuel lmazuel added the Client This issue points to a problem in the data-plane of the library. label Jul 14, 2021
@lmazuel
Copy link
Member

lmazuel commented Jul 14, 2021

Start with a methid like:

def gimme_bytes(o : Union[SBMessage, EHMessage, QueueMessage]) -> bytes:
   ...

You can't import any SDKs, since you're inside azure core (duck typing)

@yunhaoling yunhaoling added blocking-release Blocks release P0 and removed blocking-release Blocks release labels Jul 14, 2021
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this issue Jun 6, 2022
[DataFactory]Add support OAuth2ClientCredential auth in RestSevice (Azure#19247)

* [DataFactory]Added privateEndpoint Into PrivateLinkConnectionApprovalRequest

* update

* [DataFactory]Add support OAuth2ClientCredential auth in RestSevice

* merge
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. Event Grid Messaging Messaging crew P0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants