Fixing stream ID issue in publishing to CEP

Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/56b52659
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/56b52659
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/56b52659

Branch: refs/heads/master
Commit: 56b52659da488bce06b0a14716e6dcd1b4ebf520
Parents: 32d2ecc
Author: Chamila de Alwis <[email protected]>
Authored: Thu Oct 16 14:29:29 2014 +0530
Committer: Chamila de Alwis <[email protected]>
Committed: Thu Oct 16 14:29:29 2014 +0530

----------------------------------------------------------------------
 .../cartridge-agent/modules/databridge/agent.py             | 9 +++++++++
 .../cartridge-agent/modules/databridge/thrift/publisher.py  | 6 ++----
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/56b52659/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py
----------------------------------------------------------------------
diff --git 
a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py 
b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py
index c4357df..8146666 100644
--- a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py
+++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py
@@ -45,6 +45,8 @@ class StreamDefinition:
         """:type : list[str]"""
         self.payload_data = []
         """:type : list[str]"""
+        self.stream_id =  None
+        """ :type : str """
 
     def add_metadata_attribute(self, attr_name, attr_type):
         self.meta_data.append({"name": attr_name, "type": attr_type})
@@ -141,6 +143,13 @@ class ThriftPublisher:
         self.__publisher.defineStream(str(stream_definition))
         ThriftPublisher.log.debug("DEFINED STREAM to %r:%r with stream 
definition %r" % (ip, port, str(stream_definition)))
 
+        self.stream_definition = stream_definition
+        self.stream_id = self.__publisher.streamId
+        self.ip = ip
+        self.port = port
+        self.username = username
+        self.password = password
+
     def publish(self, event):
         """
         Publishes the given event by creating the event bundle from the log 
event

http://git-wip-us.apache.org/repos/asf/stratos/blob/56b52659/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/publisher.py
----------------------------------------------------------------------
diff --git 
a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/publisher.py
 
b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/publisher.py
index b33c8ac..325b05d 100644
--- 
a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/publisher.py
+++ 
b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/publisher.py
@@ -21,7 +21,6 @@ import sys
 sys.path.append("gen")
 
 from gen.ThriftSecureEventTransmissionService import 
ThriftSecureEventTransmissionService
-from gen.ThriftSecureEventTransmissionService.ttypes import *
 from gen.Data.ttypes import ThriftEventBundle
 
 from thrift.transport import TSSLSocket
@@ -60,12 +59,11 @@ class Publisher:
         # Build thrift event bundle
         #event = EventBundle()
         event.setSessionId(self.sessionId)
-        event.setEventNum(1)
-        event.addLongAttribute(time.time() * 1000)
+        event.setEventNum(0)
         event.addStringAttribute(self.streamId)
+        event.addLongAttribute(time.time() * 1000)
         #event.addStringAttribute(msg)
         # Publish
-        print "TO THE WIRE!!! "
         Publisher.client.publish(event.getEventBundle())
 
     def disconnect(self):

Reply via email to