Design question about canonicals

My client uses publishable canonicals in between the backend and external documents for both inbound and outbound transactions. Due to mergers, inbound canonicals can have different destinations for the same doc type.

For example an inbound invoice could be saved to a local directory whereas other invoices are stored in the database. We know which external documents should go where (based on location of these files - flat, XML, X12) say when retrieved from a specific ftp server.

I normally like to use TN for routing but since these external documents get mapped to the canonical and then are published, all we have is the canonical to determine routing, so I’m thinking if possible the receiverID if it is unique for all docs going to the db (versus the file system), or set some other flag in the canonical, so I can set a filter on the trigger.

Any thoughts on design would be appreciated!

Adding some sort of context field to the publishable document makes sense to me.

You might consider adding the “source system” or something like that instead of the receiverID. That way the source components don’t get tied to where the doc gets delivered–in the pub/sub model the publisher doesn’t know where it is going, right?

Then a subscriber can be configured with “I want invoices from X, Y and Z”.

Makes sense Rob thanks.