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

[BUG] Unable to cast application property attribute from ServiceBusReceivedMessage #26065

Closed
3 tasks done
DonadoJuan opened this issue Dec 16, 2021 · 0 comments · Fixed by #27146
Closed
3 tasks done
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus
Milestone

Comments

@DonadoJuan
Copy link

DonadoJuan commented Dec 16, 2021

Describe the bug
Dotnet application includes a DateTimeOffset object within the application properties of a service bus message. Then this service bus message is sent to an event bus.

Java application receives the service bus message but it is unable to properly cast DateTimeOffset object sent within application properties. The object in question is instead retrieved as a org.apache.qpid.proton.codec.DecoderImpl$UnknownDescribedType object.

Exception or Stack Trace
No exceptions are thrown

To Reproduce
Steps to reproduce the behavior:

  1. dotnet application: Send a service bus message including a TimeDateOffset object within application properties dictionary.
  2. Java application: retrieve the service bus message sent by dotnet application and inspect the time attribute included in application properties dictionary.

Code Snippet

  1. dotnet application: Send a service bus message including a TimeDateOffset object within application properties dictionary.
            // set up service bus connection
            ServiceBusClient sbc = new ServiceBusClient("<CONNECTION_STRING>");
            ServiceBusSender sbs = sbc.CreateSender("<TOPIC_NAME>");

            // create service bus message
            ServiceBusMessage message = new ServiceBusMessage();

            // add DateTimeOffSet object within application properties dictionary
            message.ApplicationProperties.Add("time", DateTimeOffset.UtcNow);
           
            // sent message to service bus
            await sbs.SendMessageAsync(message);
  1. Java application: retrieve the service bus message sent by dotnet application and inspect the time attribute included in application properties dictionary.
       // set up service bus connection
        var busClientBuilder = new ServiceBusClientBuilder()
                .connectionString("<CONNECTION_STRING>");

        var busClientReceiver = busClientBuilder
                .receiver()
                .topicName("<TOPIC_NAME>")
                .subscriptionName("<SUBSCRIPTION_NAME>")
                .buildClient();

        var messageOptional = busClientReceiver
                .receiveMessages(1, Duration.ofSeconds(10))
                .stream()
                .findFirst();

        // receives service bus message sent from dotnet application and inspect time attribute
        if(messageOptional.isPresent())
        {
            var message = messageOptional.get();
            var appProps = message.getApplicationProperties();
            var timeObject = appProps.getOrDefault("time", null);
            System.out.println(timeObject.getClass());
        }

Screenshot from Java debugger which shows the object type of time attribute:

image

Expected behavior
I expected to receive time attribute with a proper class type (e.g. long/int representation of DateTimeOffset object)

Screenshots
Screenshots shown above

Setup (please complete the following information):

  • OS: Windows 10
  • IDE: Visual Studio (dotnet) / IntelliJ (Java)
  • Library/Libraries: com.azure:azure-messaging-servicebus:7.5.0
  • Java version: 10
  • App Server/Environment: Azure service bus
  • Frameworks: none

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Dec 16, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Dec 16, 2021
@ramya-rao-a ramya-rao-a assigned ki1729 and unassigned anuchandy Jan 13, 2022
@ramya-rao-a ramya-rao-a added the Client This issue points to a problem in the data-plane of the library. label Jan 13, 2022
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jan 13, 2022
@ramya-rao-a ramya-rao-a added this to the [2022] February milestone Jan 13, 2022
@ramya-rao-a ramya-rao-a assigned ZejiaJiang and unassigned ki1729 Feb 8, 2022
@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
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants