How to stop further processing of the composite route in routescript

Skip to first unread message


Aug 17, 2021, 9:39:20 AMAug 17
to Bots Open Source EDI Translator
Hi all,

I need to stop/prevent further processing of the following route parts of my composite route in the routescript.
Currently I raise an Exception preincommunication of route part 3 but as I just noticed Bots continues with route part 4 then.
I thought Bots would stop processing the whole route when an Exception is raised.
How can I stop/prevent further processing of the following route parts?

What am I trying to do / Why do I need this?
I think I have a few more routescripts where this unexpected behaviour could cause the strange issues that happen from time to time that I could not yet figure out.

But in this specific case:
I have a PDF version of my invoices that should be sent out via SMTP in parallel to the EDIFACT via SFTP.
In route part 2 I send my EDIFACTs to a temp directory on disk.
Then in route part 3 I pass-through the EDIFACTs to the SFTP destination.
Finally in route part 4 I pass-through the PDFs to the SMTP destination.

In my routescript I use preincommunication for route part 3 where I rename the PDFs the same as the EDIFACT counterparts except the file extension and check a) if every EDI file has a PDF file and b) if every PDF file has a EDI file. If not, I move the problematic files to an error directory and raise an Exception.
The problem is that the PDFs are sent out anyhow in route part 4 then even though the EDIFACTs were not yet sent as there was an Exception preincommunication of route part 3.

So thats my problem currently.

I'm looking forward to your help.

Thanks & best regards

Henk-Jan Ebbers

Aug 17, 2021, 10:18:51 AMAug 17
I would recommend doing those checks at source level, not in bots. (bots is translator/communication. this is application logic)

else use persists (in mapping and/or communication scripts).
use eg invoice as key.

kind regards,
Henk-Jan Ebbers
t: +31 6 14612879

Bots Open Source EDI Translator:
Connect edi-partners at lower costs by smarter testing:

You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit


Aug 19, 2021, 5:49:49 AMAug 19
to Bots Open Source EDI Translator
I know, but unfortunately I have to do these checks in Bots.

Persist was a great idea though.
I do save a flag now in persist if previous route parts failed and if so I raise an Exception in all the following ones too so that they only run one by one without interruption.
Works great. 🙂

## Runs always at the very beginning before anything is done in this route (part)
def start(routedict,*args,**kwargs):
    ## Always set routescriptExceptionStatus to False before anything is done in this route (part)
    if routedict['seq'] == 1:
        transform.persist_add_update(routedict['idroute'], 'routescriptExceptionStatus', False)

    ## In later route parts ..
        ## .. always check if previous route parts encountered an exception and if true skip the following ones because the logic only works when they run one by one without interruption
        if transform.persist_lookup(routedict['idroute'], 'routescriptExceptionStatus'):
            raise Exception('Previous route part encountered an exception, so skip this one too!')

Thanks & best regards

Eppye Bots

Aug 19, 2021, 5:57:22 AMAug 19
to 'Chuck Turco' via Bots Open Source EDI Translator
but why the whole route?
normally things are document-based?

kind regards, Henk-Jan Ebbers


Aug 19, 2021, 7:34:36 AMAug 19
to Bots Open Source EDI Translator
In this case I thought it is easier/better to do it like that.
As I'm working with PDFs here I don't know the file content.
I could take it from file name but well, I'm not sure if this is so much better then.
Anyhow it should only happen 2-3 times a month that a file is missing, so it's reasonable to it like that.

Thanks & best regards

Reply all
Reply to author
0 new messages