Hi Isuru,

I'm sorry I think I have mentioned it as private in the mail but in the
file in git it is public. May be we could change it to protected.

Thanks
Imesh


On Wed, Oct 16, 2013 at 11:12 PM, Isuru Haththotuwa <[email protected]> wrote:

> Hi Imesh,
>
> On Wed, Oct 16, 2013 at 10:56 AM, Imesh Gunaratne <[email protected]>wrote:
>
>> Hi,
>>
>> Please find the below sample for publishing and receiving an event
>> message using the new messaging system.
>> *
>> *
>> *Publishing an Event Message*
>>
>> ...
>> ServiceCreatedEvent event = new ServiceCreatedEvent();
>> event.setServiceName("AppServer");
>> TopologyEventMessage message = new TopologyEventMessage(event);
>> publisher.sendMessage(message.getJson());
>>
>> *
>> *
>> *Receiving an Event Message*
>>
>> package org.apache.stratos.messaging.message;
>>
>> class MessageProcessor {
>>     private Object jsonToObject(String json, Class type) {
>>         ...
>>     }
>>
>>     public EventMessageHeader readHeader(String json) {
>>         ...
>>     }
>> }
>>
>>
>> class TopologyEventMessageProcessor extends MessageProcessor {
>>     public void run() {
>>         ...
>>         String json = subscriber.receive();
>>         // Read message header to identify the event, this will only
>> parse the header
>>         EventMessageHeader header = readHeader(json);
>>
>>         if
>> (header.getEventClassName().equals(ServiceCreatedEvent.class.getName())) {
>>             // Read the complete message and build the event
>>             TopologyEventMessage message = jsonToObject(json,
>> TopologyEventMessage.class);
>>             ServiceCreatedEvent event = jsonToObject(message.getBody(),
>> ServiceCreatedEvent.class);
>>             ...
>>         }
>>     }
>> }
>>
>
> In the MessageProcessor class, the method jsonToObject(String json, Class
> type) is marked as private, and you seem to have used another method with
> the same signature it in the TopologyEventMessageProcessor class. Is this
> method intentionally not exposed via the MessageProcessor class? Maybe we
> could make it protected so that it can be overridden at a concrete
> MessageProcessor class?
>
>>
>> *jndi.properties File Content*
>> connectionfactoryName=topicConnectionfactory
>> connectionfactory.topicConnectionfactory=amqp://admin:admin@carbon
>> /carbon?brokerlist='tcp://localhost:5677'
>>
>> java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory
>>
>>
>> Thanks
>> Imesh
>>
>
>
>
> --
> Thanks and Regards,
>
> Isuru H.
> Software Engineer, WSO2 Inc.
> +94 716 358 048* <http://wso2.com/>*
>
>
>

Reply via email to