Esempio n. 1
0
def makeSubscriberService(endpoint, local_ivo, validators, handlers, filters):
    """Create a reconnecting VOEvent subscriber service.

    Parameters
    ----------
    endpoint : implements `twisted.internet.interfaces.IStreamClientEndpoint`
        The endpoint to which the service will connect.
    local_ivo : `str` or `None`
        IVOA identifier for the subscriber.
    validators : `list` of implementers of `~comet.icomet.IValidator`.
        Validators which will be applied to incoming events. Events which fail
        validation will be rejected.
    handlers : `list` of implementers of `~comet.icomet.IHandler`.
        Handlers to which events which pass validation will be passed.
    filters : `list` of `str`
        XPath filters. Will be passed to upstream as a request to filter the
        alerts being sent.

    Notes
    -----
    Upstream brokes may not provide support for XPath filtering; in this case,
    the filters suppplied will be ignored.

    Reconnection is handled according to the default policies of
    `twisted.application.internet.ClientService`.
    """
    factory = VOEventSubscriberFactory(local_ivo, validators,handlers, filters)
    service = ClientService(endpoint, factory)

    return service
Esempio n. 2
0
 def setUp(self):
     factory = VOEventSubscriberFactory(DUMMY_EVENT_IVOID)
     self.clock = task.Clock()
     factory.callLater = self.clock.callLater
     self.proto = factory.buildProtocol(('127.0.0.1', 0))
     self.proto.callLater = self.clock.callLater  # Original in TimeoutMixin
     self.tr = proto_helpers.StringTransportWithDisconnection()
     self.proto.makeConnection(self.tr)
     self.tr.protocol = self.proto
Esempio n. 3
0
 def setUp(self):
     factory = VOEventSubscriberFactory(self.IVOID)
     factory.callLater = task.Clock().callLater
     self.proto = factory.buildProtocol(('127.0.0.1', 0))
     self.tr = proto_helpers.StringTransport()
     self.proto.makeConnection(self.tr)
Esempio n. 4
0
 def setUp(self):
     self.clock = task.Clock()
     self.factory = VOEventSubscriberFactory(DUMMY_EVENT_IVOID)
     self.factory.callLater = self.clock.callLater
     self.transport = proto_helpers.StringTransportWithDisconnection()
     self.proto = self.factory.buildProtocol(('127.0.0.1', 0))