Uploaded image for project: 'Stratos'
  1. Stratos
  2. STRATOS-791

MQTT protocol support for the messaging module

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.0 RC3
    • Component/s: None
    • Labels:
      None

      Description

      With referring to the discussion MQTT will be used as messaging protocol.

      [1]Messaging protocol with Stratos python cartridge agent

        Activity

        Hide
        gayangk Gayan Gunarathne added a comment -
        Show
        gayangk Gayan Gunarathne added a comment - Pull request - https://github.com/apache/stratos/pull/47
        Hide
        nirmal Nirmal Fernando added a comment -

        Hi Gayan,

        Is there any reason for the following check? AFAIU message instance is already a MqttMessage, isn't it?

        public void messageArrived(String arg0, MqttMessage message)
        throws Exception {
        if (message instanceof MqttMessage) {
        ...............

        Show
        nirmal Nirmal Fernando added a comment - Hi Gayan, Is there any reason for the following check? AFAIU message instance is already a MqttMessage, isn't it? public void messageArrived(String arg0, MqttMessage message) throws Exception { if (message instanceof MqttMessage) { ...............
        Hide
        gayangk Gayan Gunarathne added a comment -

        Yeah. Need to remove this. We don't need this.

        Show
        gayangk Gayan Gunarathne added a comment - Yeah. Need to remove this. We don't need this.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user swgkg opened a pull request:

        https://github.com/apache/stratos/pull/86

        Fixes for error in publishing artifact updated event - STRATOS-791

        This pull image contains the fixes for :
        Error in publishing artifact updated event - STRATOS-858
        Re factoring the code - STRATOS-791

        Please review and merge

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/gayangunarathne/stratos master

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/stratos/pull/86.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #86


        commit c7b766818a65bf2016112bf28f0c34b61e8ae614
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-09T06:35:54Z

        fixes for STRATOS-791


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user swgkg opened a pull request: https://github.com/apache/stratos/pull/86 Fixes for error in publishing artifact updated event - STRATOS-791 This pull image contains the fixes for : Error in publishing artifact updated event - STRATOS-858 Re factoring the code - STRATOS-791 Please review and merge You can merge this pull request into a Git repository by running: $ git pull https://github.com/gayangunarathne/stratos master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/stratos/pull/86.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #86 commit c7b766818a65bf2016112bf28f0c34b61e8ae614 Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-09T06:35:54Z fixes for STRATOS-791
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user swgkg opened a pull request:

        https://github.com/apache/stratos/pull/87

        Fixes for error in publishing artifact updated event - STRATOS-791

        This pull image contains the fixes for :
        Error in publishing artifact updated event - STRATOS-858
        Re factoring the code - STRATOS-791

        Please review and merge

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/gayangunarathne/stratos container-autoscaling

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/stratos/pull/87.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #87


        commit 9a8b4b4d739f39a0bb8ebe3b408de66017f27a49
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-09T06:35:54Z

        fixes for STRATOS-791

        commit 6f62751f59c25db4e04907b931b58c5819a406eb
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-10T10:34:06Z

        Refactor class


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user swgkg opened a pull request: https://github.com/apache/stratos/pull/87 Fixes for error in publishing artifact updated event - STRATOS-791 This pull image contains the fixes for : Error in publishing artifact updated event - STRATOS-858 Re factoring the code - STRATOS-791 Please review and merge You can merge this pull request into a Git repository by running: $ git pull https://github.com/gayangunarathne/stratos container-autoscaling Alternatively you can review and apply these changes as the patch at: https://github.com/apache/stratos/pull/87.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #87 commit 9a8b4b4d739f39a0bb8ebe3b408de66017f27a49 Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-09T06:35:54Z fixes for STRATOS-791 commit 6f62751f59c25db4e04907b931b58c5819a406eb Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-10T10:34:06Z Refactor class
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user nirmal070125 commented on the pull request:

        https://github.com/apache/stratos/pull/87#issuecomment-58753105

        Gayan, Could you please rebase and send a new PR?

        Show
        githubbot ASF GitHub Bot added a comment - Github user nirmal070125 commented on the pull request: https://github.com/apache/stratos/pull/87#issuecomment-58753105 Gayan, Could you please rebase and send a new PR?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swgkg commented on the pull request:

        https://github.com/apache/stratos/pull/87#issuecomment-58847215

        Will add a new pull request

        Show
        githubbot ASF GitHub Bot added a comment - Github user swgkg commented on the pull request: https://github.com/apache/stratos/pull/87#issuecomment-58847215 Will add a new pull request
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swgkg closed the pull request at:

        https://github.com/apache/stratos/pull/87

        Show
        githubbot ASF GitHub Bot added a comment - Github user swgkg closed the pull request at: https://github.com/apache/stratos/pull/87
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user swgkg opened a pull request:

        https://github.com/apache/stratos/pull/91

        Fixes for error in publishing artifact updated event - STRATOS-791

        This pull image contains the fixes for :
        Error in publishing artifact updated event - STRATOS-858
        Re factoring the code - STRATOS-791

        Please review and merge

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/gayangunarathne/stratos container-autoscaling

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/stratos/pull/91.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #91


        commit 9a8b4b4d739f39a0bb8ebe3b408de66017f27a49
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-09T06:35:54Z

        fixes for STRATOS-791

        commit 6f62751f59c25db4e04907b931b58c5819a406eb
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-10T10:34:06Z

        Refactor class

        commit 1f908583664c7c449a73d7cefe91cd165457dd1c
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-10T12:04:51Z

        Merge branch 'container-autoscaling' of https://github.com/apache/stratos into container-autoscaling

        commit 166b4d6cf833b3114d874ba935de2a1fda02c94a
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-10T12:38:02Z

        Remove the # sign with health summarize events

        commit aa06009396f86a11124adb15186a5dce50022b19
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-13T04:47:54Z

        Merge branch 'container-autoscaling' of https://github.com/apache/stratos into container-autoscaling

        commit 34b8f6ac882c7230c08ae9e505fdce9c402635dc
        Author: gayan <gayan@puppet.gayan.org>
        Date: 2014-10-13T04:50:22Z

        update with refactoring


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user swgkg opened a pull request: https://github.com/apache/stratos/pull/91 Fixes for error in publishing artifact updated event - STRATOS-791 This pull image contains the fixes for : Error in publishing artifact updated event - STRATOS-858 Re factoring the code - STRATOS-791 Please review and merge You can merge this pull request into a Git repository by running: $ git pull https://github.com/gayangunarathne/stratos container-autoscaling Alternatively you can review and apply these changes as the patch at: https://github.com/apache/stratos/pull/91.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #91 commit 9a8b4b4d739f39a0bb8ebe3b408de66017f27a49 Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-09T06:35:54Z fixes for STRATOS-791 commit 6f62751f59c25db4e04907b931b58c5819a406eb Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-10T10:34:06Z Refactor class commit 1f908583664c7c449a73d7cefe91cd165457dd1c Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-10T12:04:51Z Merge branch 'container-autoscaling' of https://github.com/apache/stratos into container-autoscaling commit 166b4d6cf833b3114d874ba935de2a1fda02c94a Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-10T12:38:02Z Remove the # sign with health summarize events commit aa06009396f86a11124adb15186a5dce50022b19 Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-13T04:47:54Z Merge branch 'container-autoscaling' of https://github.com/apache/stratos into container-autoscaling commit 34b8f6ac882c7230c08ae9e505fdce9c402635dc Author: gayan <gayan@puppet.gayan.org> Date: 2014-10-13T04:50:22Z update with refactoring
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swgkg commented on the pull request:

        https://github.com/apache/stratos/pull/87#issuecomment-58847370

        New pull request -
        https://github.com/apache/stratos/pull/91

        Show
        githubbot ASF GitHub Bot added a comment - Github user swgkg commented on the pull request: https://github.com/apache/stratos/pull/87#issuecomment-58847370 New pull request - https://github.com/apache/stratos/pull/91
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user imesh commented on a diff in the pull request:

        https://github.com/apache/stratos/pull/86#discussion_r20130914

        — Diff: components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/publish/TopicPublisher.java —
        @@ -69,48 +70,49 @@
        public void publish(Object messageObj, boolean retry) {

        synchronized (TopicPublisher.class) {

        • Gson gson = new Gson();
        • String message = gson.toJson(messageObj);
        • boolean published = false;
        • while (!published)
        • try { - mqttClient = MQTTConnector.getMQTTConClient(); - - MqttMessage mqttMSG = new MqttMessage(message.getBytes()); - - mqttMSG.setQos(QOS); - MqttConnectOptions connOpts = new MqttConnectOptions(); - connOpts.setCleanSession(true); - mqttClient.connect(connOpts); - mqttClient.publish(topic, mqttMSG); - mqttClient.disconnect(); - published = true; - }

          catch (Exception e) {

        • initialized = false;
        • if (log.isErrorEnabled()) { - log.error("Error while publishing to the topic: " + topic, e); - }
        • if (!retry) {
        • if (log.isDebugEnabled()) { - log.debug("Retry disabled for topic " + topic); - }
        • throw new RuntimeException(e);
        • }
          -
        • if (log.isInfoEnabled()) { - log.info("Will try to re-publish in 60 sec"); - }
        • try { - Thread.sleep(60000); - }

          catch (InterruptedException ignore)

          { - }
        • }
        • finally { - - }
        • }
          + Gson gson = new Gson();
            • End diff –

        Loos like we have an indentation issue here. Can you please correct this?
        Thanks

        Show
        githubbot ASF GitHub Bot added a comment - Github user imesh commented on a diff in the pull request: https://github.com/apache/stratos/pull/86#discussion_r20130914 — Diff: components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/publish/TopicPublisher.java — @@ -69,48 +70,49 @@ public void publish(Object messageObj, boolean retry) { synchronized (TopicPublisher.class) { Gson gson = new Gson(); String message = gson.toJson(messageObj); boolean published = false; while (!published) try { - mqttClient = MQTTConnector.getMQTTConClient(); - - MqttMessage mqttMSG = new MqttMessage(message.getBytes()); - - mqttMSG.setQos(QOS); - MqttConnectOptions connOpts = new MqttConnectOptions(); - connOpts.setCleanSession(true); - mqttClient.connect(connOpts); - mqttClient.publish(topic, mqttMSG); - mqttClient.disconnect(); - published = true; - } catch (Exception e) { initialized = false; if (log.isErrorEnabled()) { - log.error("Error while publishing to the topic: " + topic, e); - } if (!retry) { if (log.isDebugEnabled()) { - log.debug("Retry disabled for topic " + topic); - } throw new RuntimeException(e); } - if (log.isInfoEnabled()) { - log.info("Will try to re-publish in 60 sec"); - } try { - Thread.sleep(60000); - } catch (InterruptedException ignore) { - } } finally { - - } } + Gson gson = new Gson(); End diff – Loos like we have an indentation issue here. Can you please correct this? Thanks
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user imesh commented on a diff in the pull request:

        https://github.com/apache/stratos/pull/86#discussion_r20130930

        — Diff: components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/subscribe/TopicSubscriber.java —
        @@ -46,15 +46,14 @@

        private boolean terminated = false;
        private MqttCallback messageListener;

        • private TopicSession topicSession;
          +
          private final String topicName;

        private TopicHealthChecker healthChecker;
        private final javax.jms.TopicSubscriber topicSubscriber = null;
        private boolean subscribed;

        • private final MessageProcessorChain processorChain;
        • /**
          + /**
            • End diff –

        Another minor indentation issue. Will you be able to correct please?
        Thanks

        Show
        githubbot ASF GitHub Bot added a comment - Github user imesh commented on a diff in the pull request: https://github.com/apache/stratos/pull/86#discussion_r20130930 — Diff: components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/broker/subscribe/TopicSubscriber.java — @@ -46,15 +46,14 @@ private boolean terminated = false; private MqttCallback messageListener; private TopicSession topicSession; + private final String topicName; private TopicHealthChecker healthChecker; private final javax.jms.TopicSubscriber topicSubscriber = null; private boolean subscribed; private final MessageProcessorChain processorChain; /** + /** End diff – Another minor indentation issue. Will you be able to correct please? Thanks
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swgkg commented on the pull request:

        https://github.com/apache/stratos/pull/86#issuecomment-62505258

        Hi Imesh,

        Thank you for pointing this. As I see those changes are already merge with the code.Hence closing the PR.

        Thanks,
        Gayan

        Show
        githubbot ASF GitHub Bot added a comment - Github user swgkg commented on the pull request: https://github.com/apache/stratos/pull/86#issuecomment-62505258 Hi Imesh, Thank you for pointing this. As I see those changes are already merge with the code.Hence closing the PR. Thanks, Gayan
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swgkg closed the pull request at:

        https://github.com/apache/stratos/pull/86

        Show
        githubbot ASF GitHub Bot added a comment - Github user swgkg closed the pull request at: https://github.com/apache/stratos/pull/86
        Hide
        gayangk Gayan Gunarathne added a comment -

        PR 86 is already merged , hence resolving the issue

        Show
        gayangk Gayan Gunarathne added a comment - PR 86 is already merged , hence resolving the issue
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swgkg commented on the pull request:

        https://github.com/apache/stratos/pull/91#issuecomment-69698234

        This is merged with PR#87.Hence closing this PR.

        Show
        githubbot ASF GitHub Bot added a comment - Github user swgkg commented on the pull request: https://github.com/apache/stratos/pull/91#issuecomment-69698234 This is merged with PR#87.Hence closing this PR.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user swgkg closed the pull request at:

        https://github.com/apache/stratos/pull/91

        Show
        githubbot ASF GitHub Bot added a comment - Github user swgkg closed the pull request at: https://github.com/apache/stratos/pull/91

          People

          • Assignee:
            gayangk Gayan Gunarathne
            Reporter:
            gayangk Gayan Gunarathne
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development