Use case: Receive EDIFACT message, and resolve distribution based on UNB segment
Description
In this case we are trying to receive an EDIFACT ORDERS message and have it be processed as a “Sales Order” document by a Distribution (todo: add link to definition of Distribution) we have configured:
![](../__attachments/2695626780/image-20230606-123654.png?inst-v=a204603b-72d2-4d67-b324-401abe447902)
Snippet of the EDIFACT payload
UNA:+.? 'UNB+UNOC:3+TEST-PARTNER-1:ZZ+TEST-PARTNER-2:ZZ+230606:1237+123456+++++EANCOM'UNH+1+ORDERS:D:96A:UN:EAN008'BGM+220:...
How to set up
To achieve this we need to have set up an IdentificationType (todo: insert link to definition of IdentificationType) with a qualifier matching the one used in the payload (in this case ZZ):
![](../__attachments/2695626780/image-20230606-132213.png?inst-v=a204603b-72d2-4d67-b324-401abe447902)
The sender & receiver Partner (todo: insert link to definition of Partner) on the Distriburtion (todo: insert link to definition of Distribution) must have an identification value matching the previously mentioned IdentificationType (todo: insert link to definition of IdentificationType) and the value from the payload. In this case TEST-PARTNER-1 and TEST-PARTNER-2. Example:
![](../__attachments/2695626780/image-20230606-132647.png?inst-v=a204603b-72d2-4d67-b324-401abe447902)
In order for Link to recognize our payload as a “Sales Order” document, we must configure a DocumentTypeClassifier (todo: insert link to definition of DocumentTypeClassifier). Here we specify the Edifact DocumentTypeClassifierResolver (todo: insert link to definition of DocumentTypeClassifierResolver), and specify that if the message type in the UNH segment matches “ORDERS” the payload is of DocumentType (todo: insert link to definition of DocumentType) “Sales Order“.
![](../__attachments/2695626780/image-20230606-141427.png?inst-v=a204603b-72d2-4d67-b324-401abe447902)
The DocumentTypeClassifierResolver (todo: insert link to defintion of DocumentTypeClassifierResolver) specified above should be associated with the ContentTypeGroup (todo: insert link to definition of ContentTypeGroup) “EDIFACT”. This configuration should already be in place in a new installed Link environment.
![](../__attachments/2695626780/image-20230606-144542.png?inst-v=a204603b-72d2-4d67-b324-401abe447902)
The FormatType (todo: insert link to definition of FormatType) associated with the ingoing DocumentConfg (todo: insert link to definition of DocumentConfig) of the Distribution (todo: insert link to definition of Distribution) must have the Content-Type “application/EDIFACT“ specified. Also a Disassembler (todo: insert link to definition of Disassembler) must be specified.
![](../__attachments/2695626780/image-20230606-143948.png?inst-v=a204603b-72d2-4d67-b324-401abe447902)
When this is configured we can publish a message to Link with an InitConfiguration (todo: insert link to definition of InitConfiguration) with FormatType (todo: insert link to definition of FormatType) set to “Edifact”
![](../__attachments/2695626780/image-20230606-142756.png?inst-v=a204603b-72d2-4d67-b324-401abe447902)
This should result in a “Sales Order” Document (todo: insert link to definition of Document):
![](../__attachments/2695626780/image-20230606-143012.png?inst-v=a204603b-72d2-4d67-b324-401abe447902)
How this works
Here is a conceptual overview of what happens during this initialization process:
Link updates the content-type of the message, and sets it to “application/EDIFACT” based on the configuration on the ingoing FormatType (todo: insert link to definition of FormatType) (Edifact).
Link resolves the DocumentType (todo: insert link to definition of DocumentType) as “Sales Order” by…
Identifying the DocumentTypeClassifierResolver (todo: insert link to definition of DocumentTypeClassifierResolver) as Edifact based on the message having the content-type “application/EDIFACT”.
Running the configured DocumentTypeClassifiers (todo: insert link to definition of DocumentTypeClassifier) configured with the DocumentTypeClassifierResolver (todo: insert link to definition of DocumentTypeClassifierResolver) Edifact, and finding a match on the configuration made above that is linked to DocumentType (todo: insert link to definition of DocumentType) “Sales Order”.
Link executes the Disassembler (todo: insert link to definition of Disassembler), which translates the message to XML and enriches the messages ContextProperties (todo: insert link to definition of ContextProperties) with ID and qualifier for sender and receiver among other meta-data.
Link resolves the sender Partner (todo: insert link to definition of Partner) as “Test partner #1” based on the meta-data published by the Disassmbler (todo: insert link to definition of Disassembler).
Link resolves the receiver Partner (todo: insert link to definition of Partner) as “Test partner #2” based on the meta-data published by the Disassmbler (todo: insert link to definition of Disassembler).
Link resolves the correct Distribution (todo: insert link to definition of Distribution) based on DocumentType (todo: insert link to definition of DocumentType) “Sales Order”, sender Partner (todo: insert link to definition of Partner) “Test partner #1” and receiver Partner (todo: insert link to definition of Partner) “Test partner #2”.
When the Distribution (todo: insert link to definition of Distribution) have been resolved, the Initialize component can finish by tracking the Document (todo: insert link to definition of Document), setting it’s status to “Processing”, and publishing it for further processing in the Link Itinerary Framework (todo: insert link to definition of Link Itinerary Framework).