Is there a way to get Trading Networks to send an alert of some sort when it receives an AS2 MDN with an error message (i.e. something that causes the User Status to end up as “ProcessMDNMsg:ERROR”)?
Solution - How to get an alert from a Task. ( AS2 creates tasks to send - not catch-able in the AS2 sending service)
Go to MWS (MyWebMethodsServer) web GUI
Administration > Integration > B2B Settings > Configure Properties.
Set tn.task.notifyFailure to true. That publishes wm.tn.rec:TaskFailure doc in a queue.
page 71 9-12 Trading Networks Admin
Write a dummy handling service for your alert. You need the name when you create the trigger.
Create a trigger programmatically subscribing that TaskFailure document.
Example Startup Flow service:
That is , check if your trigger already exists. (wm.server.ns.nodeExists)
Then check returned “status” if true call pub.trigger.deleteTrigger deleting it.
Then call pub.trigger.createTrigger (I called my trigger “onTaskError” in my package )
Set queueCapacity,MaxRetry,isConcurrent=false, condition= “myCondition”, serviceName = your service that handles the TaskFailure document (below). conditions/messageTypeFilterPairs/messageType = wm.tn.rec:TaskFailure
Then finish writing the flow service to be invoked by that trigger, dealing with the TaskFailure document that arrives.
Document name is “TaskFailure” - doc reference = wm.tn.rec.TaskFailure
Test it by sending a message using AS2, but changing the AS2 url to something that is wrong. like “LOLgoogle.com”
Note that this creates alerts for any task, so you may have to filter in case you have other tasks failing.