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

Migrate amqp library #194

Merged
merged 10 commits into from
May 28, 2024
Merged

Migrate amqp library #194

merged 10 commits into from
May 28, 2024

Conversation

DanielePalaia
Copy link
Collaborator

@DanielePalaia DanielePalaia commented May 22, 2024

This closes #183

The uamqp library has been replaced with the code used here:

https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp

to allow support for ARM architecture and because the uamqp library wouldn't be supported after 2025 anyway.

It seems like this library is also 15/20% faster than the original one.

In this library we are missing the body type which is automatically able to detect the type passed and to the conversion so we need to pass a binary like:

            amqp_message = AMQPMessage(
                body=bytes("hello: {}".format(i), "utf-8"),
            )

Also if you were previously using amqp fields like Properties this are now imported from rstream directly:

Before

import uamqp

message_properties = uamqp.message.MessageProperties("MessageId"+str(i), None, bytes("guest",'utf-8'), None, "CorrelationId"+str(i), "text/plain", "utf-8", None, None, None, None, 9999, "MyReplyToGroupId", None)

Now:

from rstream import
message_properties = Properties(message_id="MessageId"+str(i), user_id=None, to=bytes("guest",'utf-8'), subject=None, correlation_id="CorrelationId"+str(i), content_type="text/plain", content_encoding="utf-8", absolute_expiry_time=None, creation_time=None, reply_to_group_id="MyReplyToGroupId")

This library is also using typing_extensions as dependency which needs to be included in your application (uamqp is not used anymore and can be removed).

@DanielePalaia DanielePalaia marked this pull request as draft May 22, 2024 08:20
@DanielePalaia DanielePalaia force-pushed the migrate_amqp_library branch 7 times, most recently from e70d0b9 to 93b73c2 Compare May 22, 2024 09:01
@DanielePalaia DanielePalaia force-pushed the migrate_amqp_library branch from 93b73c2 to 241a4b3 Compare May 22, 2024 09:05
@DanielePalaia DanielePalaia marked this pull request as ready for review May 23, 2024 12:27
@DanielePalaia DanielePalaia force-pushed the migrate_amqp_library branch 2 times, most recently from c51ffdc to 0490a38 Compare May 28, 2024 08:07
@DanielePalaia DanielePalaia force-pushed the migrate_amqp_library branch from 0490a38 to efa7b49 Compare May 28, 2024 08:33
Copy link
Member

@Gsantomaggio Gsantomaggio left a comment

Choose a reason for hiding this comment

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

approved per pairing with @DanielePalaia

@DanielePalaia DanielePalaia merged commit 3e24496 into master May 28, 2024
1 check passed
@DanielePalaia DanielePalaia deleted the migrate_amqp_library branch May 28, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fail to build on Mac M* series
2 participants