Problem with @Publisher annotation
Hi,
I am using the @Publisher annotation on a method in a bean to create a heartbeat message. The method is executed every 30 seconds by a Quartz trigger. My issue is that when the method is called and returns a string nothing happens to the message. Is is not placed on the channel and not sent out my socket.
Here is the config and code:
Code:
<int:channel id="tcpSNRSend">
</int:channel>
<int-ip:tcp-connection-factory id="cfSNRClient"
type="client"
host="10.100.211.80"
port="10854"
deserializer="connectionSerializeDeserialize"
/>
<bean id="heartbeatJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="heartbeatMaintenanceCycle" />
<property name="targetMethod" value="heartbeat" />
</bean>
<bean id="heartbeatTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="heartbeatJobDetail" />
<!-- 10 seconds -->
<property name="startDelay" value="10000" />
<!-- repeat every 30 seconds -->
<property name="repeatInterval" value="30000" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="heartbeatTrigger" />
</list>
</property>
</bean>
/**
* Heartbeat
*/
@Publisher(channel="tcpSNRSend")
@Payload
public String heartbeat() {
//Create Heartbeat message
TimeZone tz = TimeZone.getTimeZone("UTC");
GregorianCalendar date = new GregorianCalendar(tz);
java.util.UUID uuid = UUID.randomUUID();
String request = "ESTP/1.0\r\n" +
ISG2Constants.CONTENT_LENGTH + ": 0\r\n" +
ISG2Constants.DATE + ": " + DateUtil.formatDate(date.getTime()) + "\r\n" +
ISG2Constants.TRANS_ID + ": " + uuid.toString() + "\r\n" +
ISG2Constants.CONTENT_TYPE + ": application/bems-healthrequest" + "\r\n";
return request;
}
Please advise.