Exemplo n.º 1
0
 def publish_prompt(self):
     prompt = Prompt(self.name, self.pipeline_id)
     try:
         publish(prompt)
     except PromptFailed:
         raise
     except Exception as e:
         raise PromptFailed("{}: {}".format(type(e), str(e)))
Exemplo n.º 2
0
 def publish_prompt(self, head_notification_id=None):
     prompt = PromptToPull(self.name, self.pipeline_id,
                           head_notification_id)
     try:
         publish(prompt)
     except PromptFailed:
         raise
     except Exception as e:
         raise PromptFailed("{}: {}".format(type(e), str(e)))
Exemplo n.º 3
0
 def publish_prompt(self, end_position=None):
     if end_position is not None:
         assert isinstance(end_position, six.integer_types), end_position
     prompt = Prompt(self.name, self.pipeline_id, end_position=end_position)
     try:
         publish(prompt)
     except PromptFailed:
         raise
     except Exception as e:
         raise PromptFailed("{}: {}".format(type(e), str(e)))
Exemplo n.º 4
0
    def publish_prompt(self, head_notification_id=None):
        """
        Publishes a "prompt to pull" (instance of
        :class:`~eventsourcing.application.simple.PromptToPull`).

        :param head_notification_id: Maximum notification ID of event records
            to be pulled.
        """
        prompt = PromptToPull(self.name, self.pipeline_id, head_notification_id)
        try:
            publish(prompt)
        except PromptFailed:
            raise
        except Exception as e:
            raise PromptFailed("{}: {}".format(type(e), str(e)))
Exemplo n.º 5
0
    def publish_prompt(self, event=None):
        """
        Publishes prompt for a given event.

        Used to prompt downstream process application when an event
        is published by this application's model, which can happen
        when application command methods, rather than the process policy,
        are called.

        Wraps exceptions with PromptFailed, to avoid application policy exceptions being
        seen directly in other applications when running synchronously in single thread.
        """

        prompt = Prompt(self.name, self.pipeline_id)
        try:
            publish(prompt)
        except PromptFailed:
            raise
        except Exception as e:
            raise PromptFailed("{}: {}".format(type(e), str(e)))
Exemplo n.º 6
0
 def raise_prompt_failed(_):
     raise PromptFailed()