예제 #1
0
파일: endpoint.py 프로젝트: pkediyal/pyon
 def __init__(self,
              process=None,
              callback=None,
              routing_call=None,
              **kwargs):
     ProcessEndpointUnitMixin.__init__(self, process=process)
     SubscriberEndpointUnit.__init__(self, callback=callback, **kwargs)
     self._routing_call = routing_call
예제 #2
0
파일: endpoint.py 프로젝트: j2project/pyon
    def _make_routing_call(self, call, timeout, *op_args, **op_kwargs):
        if not self._routing_call:
            return SubscriberEndpointUnit._make_routing_call(self, call, timeout, *op_args, **op_kwargs)

        ctx = self._process.get_context()       # pull onto the locals here, for debuggability with manhole
        ar = self._routing_call(call, ctx, *op_args, **op_kwargs)
        return ar.get() # timeout=timeout)  # REMOVED TIMEOUT
예제 #3
0
    def _make_routing_call(self, call, timeout, *op_args, **op_kwargs):
        if not self._routing_call:
            return SubscriberEndpointUnit._make_routing_call(self, call, timeout, *op_args, **op_kwargs)

        ctx = self._process.get_context()
        ar = self._routing_call(call, ctx, *op_args, **op_kwargs)
        return ar.get()  # timeout=timeout)  # REMOVED TIMEOUT
예제 #4
0
    def _make_routing_call(self, call, timeout, *op_args, **op_kwargs):
        if not self._routing_call:
            return SubscriberEndpointUnit._make_routing_call(self, call, timeout, *op_args, **op_kwargs)

        ctx = self._process.get_context()
        ar = self._routing_call(call, ctx, *op_args, **op_kwargs)
        return ar.get()  # timeout=timeout)  # REMOVED TIMEOUT
예제 #5
0
    def _make_routing_call(self, call, timeout, *op_args, **op_kwargs):
        if not self._routing_call:
            return SubscriberEndpointUnit._make_routing_call(self, call, timeout, *op_args, **op_kwargs)

        ctx = self._process.get_context()       # pull onto the locals here, for debuggability with manhole
        ar = self._routing_call(call, ctx, *op_args, **op_kwargs)
        return ar.get() # timeout=timeout)  # REMOVED TIMEOUT
예제 #6
0
    def _make_routing_call(self, call, *op_args, **op_kwargs):
        if not self._routing_call:
            return SubscriberEndpointUnit._make_routing_call(
                self, call, *op_args, **op_kwargs)

        ar = self._routing_call(call, self._process.get_context(), *op_args,
                                **op_kwargs)
        return ar.get()  # @TODO: timeout?
예제 #7
0
    def _build_header(self, raw_msg, raw_headers):
        """
        Override to direct the calls in _build_header - first the Subscriber, then the Process mixin.
        """
        header1 = SubscriberEndpointUnit._build_header(self, raw_msg, raw_headers)
        header2 = ProcessEndpointUnitMixin._build_header(self, raw_msg, raw_headers)

        header1.update(header2)

        return header1
예제 #8
0
    def _build_header(self, raw_msg, raw_headers):
        """
        Override to direct the calls in _build_header - first the Subscriber, then the Process mixin.
        """
        header1 = SubscriberEndpointUnit._build_header(self, raw_msg, raw_headers)
        header2 = ProcessEndpointUnitMixin._build_header(self, raw_msg, raw_headers)

        header1.update(header2)

        return header1
예제 #9
0
파일: endpoint.py 프로젝트: j2project/pyon
    def _message_received(self, msg, headers):
        """
        Message received override.

        Sets the process' context here to be picked up by subsequent calls out by this service to other services, or replies.
        """
        ######
        ###### THIS IS WHERE THE THREAD LOCAL HEADERS CONTEXT IS SET ######
        ######

        # With the property _routing_call set, as is the case 95% of the time in the Process-level endpoints,
        # we have to set the call context from the ION process' calling greenlet, as context is greenlet-specific.
        # This is done in the _make_routing_call override here, passing it the context to be set.
        # See also IonProcessThread._control_flow.

        with self._process.push_context(headers):
            return SubscriberEndpointUnit._message_received(self, msg, headers)
예제 #10
0
파일: endpoint.py 프로젝트: pkediyal/pyon
    def _message_received(self, msg, headers):
        """
        Message received override.

        Sets the process' context here to be picked up by subsequent calls out by this service to other services, or replies.
        """
        ######
        ###### THIS IS WHERE THE THREAD LOCAL HEADERS CONTEXT IS SET ######
        ######

        # With the property _routing_call set, as is the case 95% of the time in the Process-level endpoints,
        # we have to set the call context from the ION process' calling greenlet, as context is greenlet-specific.
        # This is done in the _make_routing_call override here, passing it the context to be set.
        # See also IonProcessThread._control_flow.

        with self._process.push_context(headers):
            return SubscriberEndpointUnit._message_received(self, msg, headers)
예제 #11
0
파일: endpoint.py 프로젝트: j2project/pyon
 def __init__(self, process=None, callback=None, routing_call=None, **kwargs):
     ProcessEndpointUnitMixin.__init__(self, process=process)
     SubscriberEndpointUnit.__init__(self, callback=callback, **kwargs)
     self._routing_call = routing_call
예제 #12
0
파일: endpoint.py 프로젝트: swarbhanu/pyon
    def _make_routing_call(self, call, *op_args, **op_kwargs):
        if not self._routing_call:
            return SubscriberEndpointUnit._make_routing_call(self, call, *op_args, **op_kwargs)

        ar = self._routing_call(call, self._process.get_context(), *op_args, **op_kwargs)
        return ar.get()     # @TODO: timeout?