I am trying to create a workflow instance through the C# package openiap.
But I’m not sure what the exchange parameter should be set to or where I can look it up.
I tried to check the OpenRPA code to see how it is done from there.
It seems to be using the QueueMessage call (in the InvokeOpenFlow activity.
var result = global.webSocketClient.QueueMessage(_workflow, _payload, RobotInstance.instance.robotqueue, bookmarkname, expiration, false, traceId, spanId);
This is in line 129
The QueueMessage method does not have an exchange parameter, and as far as I could see the exchange parameter was never set (it was null).
System.ArgumentNullException: Value cannot be null. (Parameter 'value')
at Google.Protobuf.ProtoPreconditions.CheckNotNull[T](T value, String name)
at Openiap.QueueMessageRequest.set_Exchangename(String value) in C:\Users\45311\source\repos\openiap\dotnetapi\src\proto\Queues.cs:line 760
at openiap.QueueMessage(String queuename, String exchangename, Object payload, Boolean striptoken, String correlationId, Boolean rpc) in C:\Users\45311\source\repos\openiap\dotnetapi\src\openiap.cs:line 253
QueueMessage is used for sending a message to a message queue, that is not how you create a workflow instance.
You can see an example of how to create/maintain a workflow, and how to handle workflow instances as part of web form here ( it’s nodejs, but most openiap command should be similar in c# )
And the reply to your question. in your example, Exchange should be an empty string.
QueueMessage can be used to send message to both queue’s and exchange’s so you fill out only one of them.
Thanks! It makes sense to simply create the entry in the workflow_instance collection as in the example. However what I really need (until I recreate our NodeRed logic as an agent using python or C#), is to trigger a workflow_in node in NodeRed.
I thought this would happen when I create a workflow_instance with the right properties (queue, workflow name and id etc), but it is not being triggered. Perhaps I’m still missing something. I enabled “web” on the workflow besides “rpa” which we have used until now. I seem to be missing something in order to trigger it? Any ideas?
workflow in node created a workflow entity in the workflow collection, if “web” is true you can see it inside the web interface under “Form Workflows” and a property named “queue” with the name of the message queue it’s consuming
When a user clicks one of those, the web page sends an empty message to the message queue ( queue property on the workflow )
When workflow in node receives a message it looks for an _id … if non is found it creates an instance in the openrpa_instances collection, if it finds an _id it looks up the instance in the openrpa_instances collection, update it with the new values, and then sends a message though nodered.
when the message hit’s an workflow out node, this updates the instance in the openrpa_instances collection and sends a message to the web client
web client fetches the updated instance in the openrpa_instances collection and renders the chosen form with the values from the instance