-
1. NotifyFTP and URL Property Substitution
adam704a Apr 18, 2011 7:50 AM (in response to adam704a)Hey everybody,
I ended up extending the NotifyFTP. Works great. I will post this in the next few days
-
2. NotifyFTP and URL Property Substitution
ckpasu May 15, 2011 10:36 AM (in response to adam704a)Hi Adam
I have been looking exactly for the same stuff, can you please post your solution of extending the NotifyFTP to get substitution work for the URL too.
Thanks.
-
3. NotifyFTP and URL Property Substitution
adam704a May 16, 2011 9:35 AM (in response to ckpasu)Hi Pasu,
What I ended up doing here was, I dynamically add the FTP URL as a message property in an Action
String url = createFtpUrl(hostName, userName, password);
message.getProperties().setProperty(MessageConstants.FTP_URL_PROPERTY_NAME, url );
Then in a custom ReportNotify I referenced that message property in an overrideen getFtpConfig
/**
* Get the ConfigTree for the 'ftp' element.
*
* @return ConfigTree
*/
protected ConfigTree getFtpConfig(Message message)
throws NotificationException {
ConfigTree ftpConfig = super.getFtpConfig();
String url = (String)message.getProperties().getProperty(MessageConstants.FTP_URL_PROPERTY_NAME);
url = PropertySubstituter.replaceArguments(url, message);
ftpConfig.setAttribute(FTPEpr.URL_TAG, url);
return ftpConfig;
}
Here is what my jboss-esb.xml looks like:
<ftp URL="{ftpUrl}" deletelistFile="false"
filename="{org.jboss.soa.esb.gateway.file}" listFiles="false"/>
I hope that helps.
-
4. NotifyFTP and URL Property Substitution
ckpasu May 16, 2011 11:07 AM (in response to adam704a)Thanks Adam.
When I saw your original message about extending the NotifyFTP I tried to create something similar to your custom notify class overriding the getFTPConfig just like above.
However when I try to specify that on the <target class=""> I get an instantiation failure exception.
My question is where would you specify that your custom notifier have to be notified in the processing pipeline ?
-
5. NotifyFTP and URL Property Substitution
adam704a May 16, 2011 1:43 PM (in response to ckpasu)Here is how I am configuring my custom NotifyFTP. This seems to work for me
<action class="org.jboss.soa.esb.actions.Notifier" name="File Transfer Notification">
<property name="destinations">
<NotificationList type="ok">
<target class="com.esb.action.MysNotifyFtpList">
<ftp URL="{ftpUrl}"
filename="{org.jboss.soa.esb.gateway.file}"
listFiles="false"
deletelistFile="false"/>
</target>
</NotificationList>
<NotificationList type="err">
<target class="NotifyEmail"/>
</NotificationList>
</property>
<property name="okMethod" value="notifyOK"/>
<property name="exceptionMethod" value="notifyError"/>
</action>
-
6. NotifyFTP and URL Property Substitution
ckpasu May 18, 2011 5:08 AM (in response to adam704a)Adam
Thanks for the reply. It works great now.
The getFtpConfig() method doeesn't take Message as a parameter on the NotifyFTP class. So I created a no-arg getFtpConfig() method in my custom ftp class which took care of the overriding part. But in order to get a reference to the Message object on the custom FTP class I had to override sendNotification(Message inMessage) of NotifyFTP
public void sendNotification(Message inMessage) throws NotificationException {
this.message = inMessage;
super.sendNotification(inMessage);
}
Rest all changes are just similar to what you explained before. I Appreciate the help and thanks for the immediate responses.