RouterValue class Deserialize Issue for Azure Communication Service Job Router Java SDK

Tong Jun Ng 0 Reputation points

Describe the bug

Hi, I am using Azure Communicaton Service Job Router Java SDK, when I tried to create the router queue, store the queue id inside db and get the router queue via the queue id stored inside db, it hits deserialize issue for JobValue. I expect to be able to get the queue and proceed with the job assignment. This issue seems occurred for RouterWorker, RouterJob and other classes which used RouterValue. May I know is this an issue for job router java sdk or I do any mistake?

Exception or Stack Trace com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('Queue240624081839523')

at [Source: (byte[])"{"id":"Queue240624081839523","distributionPolicyId":"Policy240624081839523","labels":{"Id":"Queue240624081839523"},"etag":""0200df90-0000-1100-0000-6678bb620000""}"; line: 1, column: 92] (through reference chain:["labels"]->java.util.LinkedHashMap["Id"])

at ~[azure-core-1.49.0.jar:1.49.0] at ~[azure-core-1.49.0.jar:1.49.0] at ~[azure-core-1.49.0.jar:1.49.0] at ~[azure-core-1.49.0.jar:1.49.0] at ~[azure-communication-jobrouter-1.1.4.jar:1.1.4] at com.communication.service.jobrouter.JobRouterSettingServiceImpl.getRouterQueue( ~[communication-service.jar:na] at com.communication.service.jobrouter.JobRouterSettingServiceImpl.createNewRouterWorker( ~[communication-service.jar:na] at com.communication.service.jobrouter.JobRouterSettingServiceImpl.findRouterWorker( ~[communication-service.jar:na] at com.communication.service.jobrouter.JobRouterSettingServiceImpl.deregisterWorker( ~[communication-service.jar:na] at com.communication.service.jobrouter.JobRouterSettingServiceImpl.updateWorkerAvailability( ~[communication-service.jar:na] at com.communication.service.profile.ProfileNameServiceImpl.updateProfileOnlineStatus( ~[communication-service.jar:na]

To Reproduce Steps to reproduce the behavior:

  1. Import Job Router java sdk dependency
  2. Create a new router queue
  3. Get router queue via the queue id

Code Snippet Create router queue:

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyMMddHHmmssSSS"); String routerQueueId = "Queue".concat(simpleDateFormat.format(new Date())); String distributionPolicyId = "Policy".concat(simpleDateFormat.format(new Date())); DistributionPolicy distributionPolicy = createDistributionPolicy(distributionPolicyId); CreateQueueOptions createQueueOptions = new CreateQueueOptions(routerQueueId, distributionPolicyId); jobRouterAdministrationClient.createQueue(createQueueOptions);

Get router queue:

if (!StringUtils.isEmpty(routerQueueId)) { sql routerQueue = jobRouterAdministrationClient.getQueue(routerQueueId); }

Expected behavior The queue seems to be created successfully, but when I try to get via the queue id, it hits deserialize issue. I expect to be able to get the queue and proceed with the job assignment.

Setup (please complete the following information):

  • OS: Mac
  • IDE: IntelliJ
  • Library/Libraries:
  • Java version: 17
  • App Server/Environment: Tomcat
  • Frameworks: Springboot

Additional context If this is an issue, what will be the expected date to solve? Is there any temporary solution for this?

Do this latest commit for Job Router solved this isssue?

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
808 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 24,736 Reputation points Microsoft Employee

    Tong Jun Ng, We appreciate you sharing the feedback on the doc improvement.

    As alzimmermsft from our PG team mentioned - "I believe you are correct that the commit you shared should fix this issue as it removed the usage of Jackson from Azure Communication Job Router, which removed the expectation that RouterValue had those JSON property names for string, int, double, and boolean values when it really doesn't."

    We are discussing and tracking on this internally.

    Currently, there is no concrete ETA to share on this. As soon as I have more updates, I'll share with you.

    As for as the workaround/alternative suggestions, we are reviewing and will post back shortly.



    You may use version 2.0.0 alpha versions, similar to the ones in this QuickStart:

    Thanks for your patience and collaboration!

     If the answer helped (pointed, you in the right direction) > please click Accept Answer - it will benefit community members to find the answers quickly. 

    0 comments No comments