-
1. Re: How to handle the failure of a Notifier?
zerayaqob Jul 20, 2012 4:53 PM (in response to mimra)Michael,
Did you figure this out? I dealing with the same issue, what to do if an FTP notifier throws an exception.
Z
-
2. Re: How to handle the failure of a Notifier?
tadayosi Jul 21, 2012 3:52 AM (in response to zerayaqob)Hi,
If you need error handling, then notifiers are not the choice because they cannot catch exceptions as Michael pointed out. Instead, you have to use routers or create custom actions for the purpose. In my opinion, notifiers should be for additional notifications where successful message delivery is not so severe, not for mainstream actions processing.
Tadayoshi
-
3. Re: How to handle the failure of a Notifier?
zerayaqob Jul 21, 2012 8:51 AM (in response to tadayosi)Thanks Tadayoshi,
The thing is I have to send a message from the bus to a remote FTP folder. From what I understand so far, a notifier is the best way to do this (is it not?). That is why I want to be able to handle a situation when a notifier throws an exception.
Z
-
4. Re: How to handle the failure of a Notifier?
zerayaqob Jul 24, 2012 1:54 PM (in response to mimra)I was able to handle this by extending the native notifer and adding some error handling code in the method that actually does the sending of the file. (NotifyFTP.sendNotification(Message message)).
-
5. Re: How to handle the failure of a Notifier?
tadayosi Jul 24, 2012 8:11 PM (in response to zerayaqob)Hello Zerayaqob,
Thank you for the sharing. It sounds a more elegant and nicer approach indeed!
Tadayoshi
-
6. Re: How to handle the failure of a Notifier?
tadayosi Jul 24, 2012 10:57 PM (in response to tadayosi)Hello Zerayaqob,
Please let me check what you actually did for later reference. Did you create your own class like org.jboss.soa.esb.notification.MyNotifyFTP extending the original NotifyFTP, and then configure jboss-esb.xml like below?
<action name="notificationAction" class="org.jboss.soa.esb.actions.Notifier">
<property name="okMethod" value="notifyOK" />
<property name="notification-details">
<NotificationList type="ok">
<target class="MyNotifyFTP">
...
</target>
</NotificationList>
</property>
</action>
Just as a humble idea, it would be nicer if the OOTB Notifier action allows custom notification classes placed in other than org.jboss.soa.esb.notification package. Of course, this would be a feature request, though.
Tadayoshi
-
7. Re: How to handle the failure of a Notifier?
zerayaqob Jul 25, 2012 10:36 AM (in response to tadayosi)Tadayoshi,
here is what I used
<NotificationList type="ok">
<target class="com.company.project.esb.CustomNotifyFTP">
<ftp
URL="sftp://${user}:${password}@${url}${directory}" filename="filename"/>
</target>
...
Notice that you are allowed to put whatever class/package in here as long as you extend NotificationTarget. What i did was get the source code for NotifyFTP and added modified the parts I wanted and left the rest untouched. This also allowed me to get the filename from the message instead of the static filename that you're forecd to use with the OOTB notifier.
Hope this helps.
-
8. Re: How to handle the failure of a Notifier?
tadayosi Jul 25, 2012 10:04 PM (in response to zerayaqob)Thanks, Zerayaqob, for your feedback! I didn't know that the Notifier is already extensible by any classes. It is great to know that.