Message Method Error for Spark Message
AnsweredHi Team,
I am sending Document's Products' External Ids in a single String (Single product External Id contains 16-18 characters) using setMessageItems method (.setMessageItems(productExternalDs)) via Spark Queue. It's processing success if that Document containing 3 or max 4 Products. In other cases, for more than 3/4 products the action is failing.
Could you please help on this or is there any other way we can send multiple product External Id in a single String.
Message message = queueService.newMessage(queueName)
.setAttribute("object", "document__v")
.setAttributeWithToken("sessionId", "${Session.SessionId}")
.setMessageItems(productExternalDs);
PutMessageResponse response = queueService.putMessage(message);
Regards,
Aparna
-
Official comment
The length of each item is too long. The maximum length per item is 100 characters. The error you are receiving is a result of that. Here are details about the Message format and the limitations:
https://developer.veevavault.com/sdk/#message-format
You will need to refactor your code to handle those limitations. The message items were ultimately designed to handle individual ids as a list element.
-
Hi Aparna,
Can you check the debug log and/or the SDK Runtime logs? We would need to know what the error is in order to help.
0 -
Below is the debug log I got
ERROR: Could not complete execution for entryPoint [com.veeva.vault.custom.actions.Vault_to_OCE#execute()] Execution ID [3] Caused by: errorType[OPERATION_NOT_ALLOWED] errorMessage[Vault Java SDK Error: [Items cannot be longer than 100] Error Id: [2411a04c-6335-4743-8b59-053220ed46f7]]
com.veeva.vault.sdk.infrastructure.core.UserFacingException: errorType[OPERATION_NOT_ALLOWED] errorMessage[Vault Java SDK Error: [Items cannot be longer than 100] Error Id: [2411a04c-6335-4743-8b59-053220ed46f7]]
at com.veeva.vault.sdk.debugger.infrastructure.remote.SdkRemoteObjectInvocationHandler.applyLocalStackStraceToRemoteException(SdkRemoteObjectInvocationHandler.java:65)
at com.veeva.vault.sdk.debugger.infrastructure.remote.SdkRemoteObjectInvocationHandler.sendMethodInvocationRequestToServer(SdkRemoteObjectInvocationHandler.java:50)
at com.veeva.vault.sdk.debugger.infrastructure.remote.SdkRemoteObjectInvocationHandler.invoke(SdkRemoteObjectInvocationHandler.java:36)
at com.sun.proxy.$Proxy22.setMessageItems(Unknown Source)
at com.veeva.vault.custom.actions.Vault_to_OCE.moveMessagesToQueue(Vault_to_OCE.java:99)
at com.veeva.vault.custom.actions.Vault_to_OCE.execute(Vault_to_OCE.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.veeva.vault.sdk.debugger.infrastructure.remote.messages.InvokeEntryPointMessageHandler$EntryPointInvocation.invoke(InvokeEntryPointMessageHandler.java:149)
at com.veeva.vault.sdk.debugger.infrastructure.remote.messages.InvokeEntryPointMessageHandler$EntryPointInvocation.access$400(InvokeEntryPointMessageHandler.java:133)
at com.veeva.vault.sdk.debugger.infrastructure.remote.messages.InvokeEntryPointMessageHandler.invoke(InvokeEntryPointMessageHandler.java:83)
at com.veeva.vault.sdk.debugger.infrastructure.remote.messages.InvokeEntryPointMessageHandler.access$100(InvokeEntryPointMessageHandler.java:26)
at com.veeva.vault.sdk.debugger.infrastructure.remote.messages.InvokeEntryPointMessageHandler$1$1.execute(InvokeEntryPointMessageHandler.java:50)
at veeva.ecm.appcodeapi.infrastructure.context.impl.SdkCodeCommandRunner.runCommand(SdkCodeCommandRunner.java:24)
at com.veeva.vault.sdk.debugger.infrastructure.remote.messages.InvokeEntryPointMessageHandler$1.execute(InvokeEntryPointMessageHandler.java:45)
at com.veeva.vault.sdk.debugger.infrastructure.remote.impl.SdkDebugClientSessionImpl.lambda$startCodeExecution$0(SdkDebugClientSessionImpl.java:35)
at com.veeva.vault.sdk.debugger.infrastructure.remote.impl.SdkDebugRequestCommunicationManager.startOrJoinCommunicationTransaction(SdkDebugRequestCommunicationManager.java:71)
at com.veeva.vault.sdk.debugger.infrastructure.remote.impl.SdkDebugClientSessionImpl.startCodeExecution(SdkDebugClientSessionImpl.java:32)
at com.veeva.vault.sdk.debugger.infrastructure.remote.messages.InvokeEntryPointMessageHandler.lambda$createThread$0(InvokeEntryPointMessageHandler.java:87)
at java.lang.Thread.run(Thread.java:748)And in Vault end (Id: 55574) we got the below error for the document.
0 -
Hi Isak,
Is there anything that you can help to refactor the code or any other way you suggest to send multiple Product External Ids in a Single string (item).
Regards,
Aparna
0 -
I can certainly help guide you with your architecture. One thing I would need to know is what is the complete use case of this design? Why do the External IDs need to be joined in the first place?
0 -
Hi Isak,
The use case is we need to send Document id, related product external ids and related country code to external system. For this we are using Spark messaging (Queue and connection).
For multiple Products for a single documents, we are trying to send as a single string like the below example: "172_10000000; 172_67890073; 172_67893" . But if it crosses 100 characters it's failing.
Please help to fix the issue.
Regards,
Aparna
0 -
My suggestion would be to just send the document version id in the spark message. Then you can query the documents externally to retrieve any additional data you need.
0 -
Hi Isak,
Is there any chance Developer team are thinking to increase the limit of 100 characters in a item and 500 items in a Spark Message in any upcoming release.
Regards,
Aparna
0 -
There are no plans to increase the character limit for an Item in a Spark message. The 500 Item limit within a message is already present. That is why I suggest sending just the document version id as Items in the message. This will allow you to process documents in bulk, and you can use those version ids to query externally to get related country codes and the external ids of the related products.
0
Please sign in to leave a comment.
Comments
9 comments