Hi Nirmal, Thanks, yes I think I misunderstood the intention of the TopicPublisher. I just introduced an event publisher (which was missing earlier) to publish events with their header values.
Thanks Imesh On Wed, Oct 23, 2013 at 11:03 AM, Nirmal Fernando <[email protected]>wrote: > Imesh, > > You have misinterpreted the API here. Please revert this and use the > 'publish(Object messageObj, Properties headers)' API operation. It's a duty > of the message publisher to set what ever the headers it needs to send. > > > On Wed, Oct 23, 2013 at 10:56 AM, <[email protected]> wrote: > >> Updated Branches: >> refs/heads/master 89191d74a -> ba0f6dd66 >> >> >> Updated TopicPublisher.publish(Object) method to set event class name >> header property >> >> >> Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo >> Commit: >> http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/2bb5c37a >> Tree: >> http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/2bb5c37a >> Diff: >> http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/2bb5c37a >> >> Branch: refs/heads/master >> Commit: 2bb5c37a9dd0022f5ec7e0d606eae56d6cd929e0 >> Parents: 4bbae15 >> Author: Imesh Gunaratne <[email protected]> >> Authored: Wed Oct 23 10:55:27 2013 +0530 >> Committer: Imesh Gunaratne <[email protected]> >> Committed: Wed Oct 23 10:55:27 2013 +0530 >> >> ---------------------------------------------------------------------- >> .../stratos/messaging/broker/publish/TopicPublisher.java | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> ---------------------------------------------------------------------- >> >> >> >> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2bb5c37a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/publish/TopicPublisher.java >> ---------------------------------------------------------------------- >> diff --git >> a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/publish/TopicPublisher.java >> b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/publish/TopicPublisher.java >> index 59ecd85..1c73399 100644 >> --- >> a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/publish/TopicPublisher.java >> +++ >> b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/publish/TopicPublisher.java >> @@ -30,6 +30,7 @@ import >> org.apache.stratos.messaging.broker.connect.TopicConnector; >> import org.apache.stratos.messaging.publish.MessagePublisher; >> >> import com.google.gson.Gson; >> +import org.apache.stratos.messaging.util.Constants; >> >> /** >> * Any instance who needs to publish data to a topic, should communicate >> with >> @@ -63,8 +64,9 @@ public class TopicPublisher extends MessagePublisher { >> * obtained. >> */ >> public void publish(Object messageObj) { >> - >> - publish(messageObj, null); >> + Properties properties = new Properties(); >> + properties.put(Constants.EVENT_CLASS_NAME, >> messageObj.getClass().getName()); >> + publish(messageObj, properties); >> } >> >> public void publish(Object messageObj, Properties headers) { >> >> > > > -- > Best Regards, > Nirmal > > Nirmal Fernando. > PPMC Member & Committer of Apache Stratos, > Senior Software Engineer, WSO2 Inc. > > Blog: http://nirmalfdo.blogspot.com/ >
