You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Nirmal Fernando <ni...@gmail.com> on 2013/10/23 07:33:20 UTC

Re: [1/2] git commit: Updated TopicPublisher.publish(Object) method to set event class name header property

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, <im...@apache.org> 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 <im...@apache.org>
> Authored: Wed Oct 23 10:55:27 2013 +0530
> Committer: Imesh Gunaratne <im...@apache.org>
> 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/

Re: [1/2] git commit: Updated TopicPublisher.publish(Object) method to set event class name header property

Posted by Imesh Gunaratne <im...@apache.org>.
Great! I'm glad you liked it!

Thanks
Imesh


On Wed, Oct 23, 2013 at 11:49 AM, Reka Thirunavukkarasu <re...@wso2.com>wrote:

> Thanks Imesh. Now it looks cleaner and easy to handle at the publisher's
> level.
>
> Thanks,
> Reka
>
>
> On Wed, Oct 23, 2013 at 11:33 AM, Nirmal Fernando <ni...@gmail.com>wrote:
>
>> Thanks Imesh. It looks good now.
>>
>>
>> On Wed, Oct 23, 2013 at 11:25 AM, Imesh Gunaratne <im...@apache.org>wrote:
>>
>>> 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 <
>>> nirmal070125@gmail.com> 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, <im...@apache.org> 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 <im...@apache.org>
>>>>> Authored: Wed Oct 23 10:55:27 2013 +0530
>>>>> Committer: Imesh Gunaratne <im...@apache.org>
>>>>> 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/
>>>>
>>>
>>>
>>
>>
>> --
>> Best Regards,
>> Nirmal
>>
>> Nirmal Fernando.
>> PPMC Member & Committer of Apache Stratos,
>> Senior Software Engineer, WSO2 Inc.
>>
>> Blog: http://nirmalfdo.blogspot.com/
>>
>
>
>
> --
> Reka Thirunavukkarasu
> Software Engineer,
> WSO2, Inc.:http://wso2.com,
> Mobile: +94776442007
>
>
>

Re: [1/2] git commit: Updated TopicPublisher.publish(Object) method to set event class name header property

Posted by Reka Thirunavukkarasu <re...@wso2.com>.
Thanks Imesh. Now it looks cleaner and easy to handle at the publisher's
level.

Thanks,
Reka


On Wed, Oct 23, 2013 at 11:33 AM, Nirmal Fernando <ni...@gmail.com>wrote:

> Thanks Imesh. It looks good now.
>
>
> On Wed, Oct 23, 2013 at 11:25 AM, Imesh Gunaratne <im...@apache.org>wrote:
>
>> 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 <nirmal070125@gmail.com
>> > 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, <im...@apache.org> 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 <im...@apache.org>
>>>> Authored: Wed Oct 23 10:55:27 2013 +0530
>>>> Committer: Imesh Gunaratne <im...@apache.org>
>>>> 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/
>>>
>>
>>
>
>
> --
> Best Regards,
> Nirmal
>
> Nirmal Fernando.
> PPMC Member & Committer of Apache Stratos,
> Senior Software Engineer, WSO2 Inc.
>
> Blog: http://nirmalfdo.blogspot.com/
>



-- 
Reka Thirunavukkarasu
Software Engineer,
WSO2, Inc.:http://wso2.com,
Mobile: +94776442007

Re: [1/2] git commit: Updated TopicPublisher.publish(Object) method to set event class name header property

Posted by Nirmal Fernando <ni...@gmail.com>.
Thanks Imesh. It looks good now.


On Wed, Oct 23, 2013 at 11:25 AM, Imesh Gunaratne <im...@apache.org> wrote:

> 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 <ni...@gmail.com>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, <im...@apache.org> 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 <im...@apache.org>
>>> Authored: Wed Oct 23 10:55:27 2013 +0530
>>> Committer: Imesh Gunaratne <im...@apache.org>
>>> 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/
>>
>
>


-- 
Best Regards,
Nirmal

Nirmal Fernando.
PPMC Member & Committer of Apache Stratos,
Senior Software Engineer, WSO2 Inc.

Blog: http://nirmalfdo.blogspot.com/

Re: [1/2] git commit: Updated TopicPublisher.publish(Object) method to set event class name header property

Posted by Imesh Gunaratne <im...@apache.org>.
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 <ni...@gmail.com>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, <im...@apache.org> 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 <im...@apache.org>
>> Authored: Wed Oct 23 10:55:27 2013 +0530
>> Committer: Imesh Gunaratne <im...@apache.org>
>> 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/
>