I think this is because we are relying on old eventing UI.
For now I suppose we can/(rather have to) live with this.
Lets create a improvement Jira and move on.

On Sun, Feb 8, 2015 at 10:51 PM, Hemika Kodikara <hem...@wso2.com> wrote:

> Any advice on this would be helpful.
>
> Hemika Kodikara
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middleware
> http://wso2.com
>
> Mobile : +94777688882
>
> On Mon, Jan 19, 2015 at 4:32 PM, Hemika Kodikara <hem...@wso2.com> wrote:
>
>> Hi All,
>>
>> Currently in MB, a topic should be able to send any message in the format
>> as a normal text, XML, etc.
>>
>> But in the UI, the topic details page(topic_manage.jsp) shows a
>> publishing message section which allows only to send XML messages.
>>
>>
>> ​
>> Following code does the publishing of the message.
>>
>> =============
>> BrokerClient brokerClient = UIUtils.getBrokerClient(config, session,
>> request);
>> String topic = request.getParameter("topic");
>> String textMsg = request.getParameter("xmlMessage");
>> session.setAttribute("errorTopic", topic);
>> session.setAttribute("xmlMessage", textMsg);
>> OMElement message;
>> String messageToBePrinted = null;
>> StAXOMBuilder builder = null;
>> try {
>> builder = new StAXOMBuilder(new ByteArrayInputStream(textMsg.getBytes()));
>>         message = builder.getDocumentElement();
>>         if (message != null) {
>> brokerClient.publish(topic, message);
>>         } else {
>> messageToBePrinted = "Error: Failed to get document element from message
>> " + textMsg;
>>         }
>> } catch (Exception e) {
>>         messageToBePrinted = "Error: while publishing the message " +
>> e.getMessage();
>> }
>>
>> if (messageToBePrinted == null) {
>> messageToBePrinted = "Successfully published the message to the topic :"
>> + topic;
>> }
>> =============
>>
>>
>> Is there a reason for this restriction ? i.e only allow to send XML
>> messages through UI ?
>>
>> Refer [1][2][3] for more code information.
>>
>> [1] -
>> https://github.com/wso2-dev/carbon-utils/blob/master/components/event/org.wso2.carbon.event.ui/src/main/resources/web/topics/topic_manage.jsp
>> [2] -
>> https://github.com/wso2-dev/carbon-utils/blob/master/components/event/org.wso2.carbon.event.ui/src/main/resources/web/topics/js/treecontrol.js
>> [3] -
>> https://github.com/wso2-dev/carbon-utils/blob/master/components/event/org.wso2.carbon.event.ui/src/main/resources/web/topics/try_it_out_invoke_ajaxprocessor.jsp
>>
>>
>> Hemika Kodikara
>> Software Engineer
>> WSO2 Inc.
>> lean . enterprise . middleware
>> http://wso2.com
>>
>> Mobile : +94777688882
>>
>
>


-- 
Ramith Jayasinghe
Technical Lead
WSO2 Inc., http://wso2.com
lean.enterprise.middleware

E: ram...@wso2.com
P: +94 777542851
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to