Example #1
0
    def send(self, msg):
        """Sends xMsgMessage object to a Clara component

        Args:
            msg (xMsgMessage): xMsg transient message object
        """
        proxy_address = ProxyAddress(ClaraUtils.get_dpe_host(msg.topic),
                                     ClaraUtils.get_dpe_port(msg.topic))
        conn = self.get_connection(proxy_address)
        self.publish(conn, msg)
Example #2
0
    def sync_send(self, msg, timeout):
        """Sends xMsgMessage object to an xMsg actor synchronously

        Args:
            msg (xMsgMessage): xMsg transient message object
            timeout (int): response message timeout in seconds
        """
        proxy_address = ProxyAddress(ClaraUtils.get_dpe_host(msg.topic),
                                     ClaraUtils.get_dpe_port(msg.topic))
        conn = self.get_connection(proxy_address)
        self.sync_publish(conn, msg, timeout)
Example #3
0
    def listen(self, topic, callback):
        """This method simply calls xMsg subscribe method passing the reference
        to user provided callback method.

        Args:
            topic (xMsgTopic): Topic of subscription
            callback (xMsgCallBack): User provided callback object
        Returns:
            xMsgSubscription
        """
        proxy_address = ProxyAddress(ClaraUtils.get_dpe_host(topic))
        handler = self.subscribe(proxy_address, topic, callback)
        return handler