way4net_krumnow
Posts: 38
Joined: Thu Mar 07, 2013 1:31 pm
Location: Germany

Multistep out-cmd - how to set status to delivered

Thu Feb 18, 2016 3:08 pm

I need to be a proxy taking Positions from Soap A, store them and send them to Soap B.

1. Project/Soap Interface A sends positions and events, I decode to GpsGate TrackPoint. OK
2. I log in the position and event (DeviceMapping Variable). OK.
3. I call the outgoind command which is part of Project/Soap B.
4. The command is executing and soap B responds. OK.
5. Now I don't know in Soap A if the sending was successfull or not as the command will always run in a timeout and always seems to fail (which is not the case!). NOT OK..

So 4/5 working and the last step is missing please help!

Questions in short:
1. How can I set the state (NOT! custum-state) of a command from inside the command?
2. How to set a listener when starting the command in Soap A to be called when command finishes?

State starts with "pending" as long as the command is executing.
The command uses a soap method and a http Sender and receives an success/error code.
If the code describes an error I want to set the command to "permanent failure", if the code is a success, the command should go to "finished".

I've tried to set custom state but it seems the gate will not understand it and will run into a timeout thus set the command to "permanent failure" even if it finished successfull.


I realize that this is a bit confusing with two soaps but I had a very similar problem with a device which had a chat function that would send a longer text in 1 to 8 parts and had an ack for each part.
I tried to write a multi-step command (with a dynamic stepMax). It did all work and did send correctly the x+1 part after ack for part x has come. But at the very end it would not know that the command had finished all parts and thus a timeout occurred. Then the chat plugin from gpsgate deleted the whole chat from the db as it thought the command had failed :(

I tried many things:
- set stepMax on command start, count up stepCurrent after each step
- override ChangeStatusForPending to return DeliveryStatus.Delivered if stepMax==stepCurrent, no success
- after last step call base.UpdateProgress(base.StepMax, base.StepMax, "Chat finished successfully", "Delivered") didn't help eather
- for this command I tried to set it to delivered from the protocol using the QueueManager but that didn't work out

With this project I had to revert to send all the parts after another without waiting for the ack thus making it a 1 step command not multi-step. All because after all had finished successfully the gate would not know it and act as if the command had failed :(

Please help to make the gate know that the command has finished with error or successfully.

User avatar
johan
GpsGate
Posts: 15403
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Multistep out-cmd - how to set status to delivered

Thu Feb 18, 2016 3:54 pm

If you check the blog section next week there is something coming out in beta that address more complex use cases like you have. I cannot say if every aspect is covered but it is in that direction.

Blogs: http://gpsgate.com/blog

Regards,
Johan

GpsGate Support

User avatar
johan
GpsGate
Posts: 15403
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Multistep out-cmd - how to set status to delivered

Wed Feb 24, 2016 5:47 pm

Take a look at Scripted Apps. It can for example be used for advanced command management.
http://gpsgate.com/blogComment/apps

Regards,
Johan

GpsGate Support

way4net_krumnow
Posts: 38
Joined: Thu Mar 07, 2013 1:31 pm
Location: Germany

RE: Multistep out-cmd - how to set status to delivered

Thu Feb 25, 2016 4:29 pm

Well I've taken a rather short look at the click script. I have already 95% of the soap service programmed in C# and it is running well, even the command runs well and sends to the soap. So it was not in question for me to re-code everything as a javascript webservice..

With click-script I cannot manipulate the command-executing state it seems (can only get name and add custom fields that don't do anything).

I know this is deep internal gate stuff, I just hoped that perhaps another user has dived that deep into command-programming..

I will now handle errors by a custom table (x_mytable scheme) and a scheduler that scans this table and re-sends everything if the soap had returned an errorcode. So I don't need to care for the status of the command-execution.

Just wanted to say that this does not break my project, I just wanted to do it "right" and have a listener that calls me when command has finished and says if it was successful or not. But now I will do my workaround and it will be good enough :)

Topic may be closed (or stay open..)

Return to “GpsGate for Developers”