示例#1
0
    def _run_letter2(self):
        messaging_system = ZMQMessagingSystem("localhost", self.registry_port,
                                              9002)
        messager = Messager()
        letter2_stream = messager.get_stream(messaging_system, "letter2",
                                             StringMessage)
        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        letter2_metrics_stream = messager.get_stream(messaging_system,
                                                     "letter2_metrics",
                                                     Metrics)
        service_runner_factory = ServiceRunnerFactory(messager)
        letter2_generator_service_runner = service_runner_factory.get_service_runner(
            LetterGeneratorService, {
                "name": "letter2_generator_service",
                "endpoint": letter2_stream.get_write_endpoint()
            },
            configuration_stream=configuration_stream,
            metrics_stream=letter2_metrics_stream)
        letter2_generator_service_runner.start()

        self.letter2_stopped = False
        while not self.letter2_stopped:
            time.sleep(1)
        letter2_generator_service_runner.terminate()
        logging.debug("THREAD _run_letter2 terminates.")
示例#2
0
    def _run_monitor(self):
        messaging_system = ZMQMessagingSystem("localhost", self.registry_port,
                                              9005)
        messager = Messager()
        letter1_metrics_stream = messager.get_stream(messaging_system,
                                                     "letter1_metrics",
                                                     Metrics)
        letter2_metrics_stream = messager.get_stream(messaging_system,
                                                     "letter2_metrics",
                                                     Metrics)
        concatenator_metrics_stream = messager.get_stream(
            messaging_system, "concatenator_metrics", Metrics)
        writer_metrics_stream = messager.get_stream(messaging_system,
                                                    "writer_metrics", Metrics)
        monitor_service = GenericMonitorService("generic_monitor_service", [
            letter1_metrics_stream.get_read_endpoint(),
            letter2_metrics_stream.get_read_endpoint(),
            concatenator_metrics_stream.get_read_endpoint(),
            writer_metrics_stream.get_read_endpoint()
        ])
        monitor_service_runner = ServiceRunner(monitor_service, messager)
        monitor_service_runner.start()

        self.monitor_stopped = False
        while not self.monitor_stopped:
            time.sleep(1)
        monitor_service_runner.terminate()
        logging.debug("THREAD _run_monitor terminates.")
示例#3
0
    def _run_writer(self):
        messaging_system = ZMQMessagingSystem("localhost", self.registry_port,
                                              9004)
        messager = Messager()
        concatenation_stream = messager.get_stream(messaging_system,
                                                   "concatenation",
                                                   StringMessage)
        control_stream = messager.get_stream(messaging_system, "control",
                                             StringMessage)
        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        writer_metrics_stream = messager.get_stream(messaging_system,
                                                    "writer_metrics", Metrics)
        service_runner_factory = ServiceRunnerFactory(messager)
        string_writer_service_runner = service_runner_factory.get_service_runner(
            StringWriterService, {
                "name": "string_writer_service",
                "string_endpoint": concatenation_stream.get_read_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            configuration_stream=configuration_stream,
            metrics_stream=writer_metrics_stream)
        string_writer_service_runner.start()

        self.writer_stopped = False
        while not self.writer_stopped:
            time.sleep(1)
        string_writer_service_runner.terminate()
        logging.debug("THREAD _run_writer terminates.")
示例#4
0
    def test(self):
        messager = Messager()

        for messaging_system in [
                QueueMessagingSystem(),
                AsciiFileMessagingSystem(),
                BlockingQueueMessagingSystem(100)
        ]:

            logging.info("Testing class {}...".format(
                messaging_system.__class__.__name__))

            stream_a = messager.get_stream(messaging_system, "topic a",
                                           StringMessage)
            stream_b = messager.get_stream(messaging_system, "topic b",
                                           StringMessage)

            out_message_a1 = StringMessage("a1")
            out_message_b1 = StringMessage("b1")
            out_message_a2 = StringMessage("a2")
            out_message_b2 = StringMessage("b2")

            out_endpoint_a = stream_a.get_endpoint()
            out_endpoint_b = stream_b.get_endpoint()

            in_endpoint_a = stream_a.get_endpoint()
            in_endpoint_b = stream_b.get_endpoint()

            messager.publish(out_endpoint_a, out_message_a1)
            messager.publish(out_endpoint_b, out_message_b1)
            messager.publish(out_endpoint_a, out_message_a2)
            messager.publish(out_endpoint_b, out_message_b2)

            in_message_a1 = None
            while in_message_a1 is None:
                time.sleep(1)
                in_message_a1 = messager.poll(in_endpoint_a)
            assert in_message_a1.get_payload() == out_message_a1.get_payload()

            in_message_b1 = None
            while in_message_b1 is None:
                time.sleep(1)
                in_message_b1 = messager.poll(in_endpoint_b)
            assert in_message_b1.get_payload() == out_message_b1.get_payload()

            in_message_a2 = None
            while in_message_a2 is None:
                time.sleep(1)
                in_message_a2 = messager.poll(in_endpoint_a)
            assert in_message_a2.get_payload() == out_message_a2.get_payload()

            in_message_b2 = None
            while in_message_b2 is None:
                time.sleep(1)
                in_message_b2 = messager.poll(in_endpoint_b)
            assert in_message_b2.get_payload() == out_message_b2.get_payload()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        service_runner_factory = ServiceRunnerFactory(messager)

        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        control_stream = messager.get_stream(messaging_system, "control",
                                             StringMessage)

        metadata_stream = messager.get_stream(messaging_system, "metadata",
                                              TOSMetadata)
        metadata_metrics_stream = messager.get_stream(messaging_system,
                                                      "metadatametrics",
                                                      Metrics)

        ice_metadata_source_service_runner = service_runner_factory.get_service_runner(
            IceMetadataSourceService, {
                "name": "ice_metadata_source_service",
                "metadata_endpoint": metadata_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=metadata_metrics_stream,
            configuration_stream=configuration_stream)

        datagram_stream = messager.get_stream(messaging_system, "datagram",
                                              VisibilityDatagram)
        datagram_metrics_stream = messager.get_stream(messaging_system,
                                                      "datagrammetrics",
                                                      Metrics)
        visibility_datagram_source_service_runner = service_runner_factory.get_service_runner(
            VisibilityDatagramSourceService, {
                "name":
                "visibility_datagram_source_service",
                "visibility_datagram_endpoint":
                datagram_stream.get_write_endpoint(),
                "control_endpoint":
                control_stream.get_read_endpoint()
            },
            metrics_stream=datagram_metrics_stream,
            configuration_stream=configuration_stream)

        # set up the align service
        chunk_stream = messager.get_stream(messaging_system, "chunk",
                                           VisibilityChunk)
        align_metrics_stream = messager.get_stream(messaging_system,
                                                   "alignmetrics", Metrics)
        align_service_runner = service_runner_factory.get_service_runner(
            AlignService, {
                "name": "align_service",
                "datagram_endpoint": datagram_stream.get_read_endpoint(),
                "metadata_endpoint": metadata_stream.get_read_endpoint(),
                "chunk_endpoint": chunk_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=align_metrics_stream,
            configuration_stream=configuration_stream)

        # set up the uvwcalculation service
        uvw_chunk_stream = messager.get_stream(messaging_system, "uvwchunk",
                                               UVWChunk)
        uvw_calculation_metrics_stream = messager.get_stream(
            messaging_system, "uvwcalcmetrics", Metrics)
        uvw_calculation_service_runner = service_runner_factory.get_service_runner(
            UVWCalculationService, {
                "name": "uvw_calculation_service",
                "observatory_name": "ASKAP",
                "visibility_chunk_endpoint": chunk_stream.get_read_endpoint(),
                "metadata_endpoint": metadata_stream.get_read_endpoint(),
                "uvw_chunk_endpoint": uvw_chunk_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=uvw_calculation_metrics_stream,
            configuration_stream=configuration_stream)

        uvw_chunk_string_stream = messager.get_stream(messaging_system,
                                                      "chunkstring",
                                                      StringMessage)
        to_string_metrics_stream = messager.get_stream(messaging_system,
                                                       "to_stringmetrics",
                                                       Metrics)
        to_string_service_runner = service_runner_factory.get_service_runner(
            ToStringService, {
                "name": "to_string_service",
                "input_endpoint": uvw_chunk_stream.get_read_endpoint(),
                "output_endpoint":
                uvw_chunk_string_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=to_string_metrics_stream,
            configuration_stream=configuration_stream)

        string_writer_metrics_stream = messager.get_stream(
            messaging_system, "stringwritermetrics", Metrics)
        string_writer_service_runner = service_runner_factory.get_service_runner(
            StringWriterService, {
                "name": "string_writer_service",
                "string_endpoint": uvw_chunk_string_stream.get_read_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            metrics_stream=string_writer_metrics_stream,
            configuration_stream=configuration_stream)

        monitor_service = GenericMonitorService("generic_monitor_service", [
            datagram_metrics_stream.get_read_endpoint(),
            metadata_metrics_stream.get_read_endpoint(),
            align_metrics_stream.get_read_endpoint(),
            uvw_calculation_metrics_stream.get_read_endpoint(),
            to_string_metrics_stream.get_read_endpoint(),
            string_writer_metrics_stream.get_read_endpoint()
        ])
        monitor_service_runner = ServiceRunner(monitor_service, messager)

        configuration_control_stream = messager.get_stream(
            messaging_system, "configurationcontrol", StringMessage)
        configuration_service = HardConfigurationService(
            "configuration_service",
            configuration_control_stream.get_read_endpoint(),
            configuration_stream.get_write_endpoint())
        configuration_service_runner = ServiceRunner(configuration_service,
                                                     messager)

        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        logging.info("Starting services")
        configuration_service_runner.start()
        monitor_service_runner.start()
        visibility_datagram_source_service_runner.start()
        ice_metadata_source_service_runner.start()
        align_service_runner.start()
        uvw_calculation_service_runner.start()
        to_string_service_runner.start()
        string_writer_service_runner.start()

        logging.info("Publishing configuration")
        mainline_configuration_control_endpoint = configuration_control_stream.get_write_endpoint(
        )

        logging.info("Issuing configuration")
        messager.publish(mainline_configuration_control_endpoint,
                         StringMessage("Start"))

        time.sleep(10)

        logging.info("Starting processing")
        mainline_control_endpoint = control_stream.get_write_endpoint()
        messager.publish(mainline_control_endpoint, StringMessage("Start"))

        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)

        messager.publish(mainline_control_endpoint, StringMessage("Stop"))

        time.sleep(10)

        ice_metadata_source_service_runner.terminate()
        visibility_datagram_source_service_runner.terminate()
        align_service_runner.terminate()
        uvw_calculation_service_runner.terminate()
        to_string_service_runner.terminate()
        string_writer_service_runner.terminate()
        monitor_service_runner.terminate()
        configuration_service_runner.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
示例#6
0
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        control_stream = messager.get_stream(messaging_system, "control",
                                             StringMessage)
        input_stream = messager.get_stream(messaging_system, "input",
                                           StringMessage)
        output_stream = messager.get_stream(messaging_system, "output",
                                            StringMessage)

        service_runner_factory = ServiceRunnerFactory(messager)

        socket_writer_service_runner = service_runner_factory.get_service_runner(
            SocketWriterService, {
                "name": "socket_writer_service",
                "input_endpoint": input_stream.get_read_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint(),
                "input_class": StringMessage
            },
            configuration_stream=configuration_stream)

        socket_reader_service_runner = service_runner_factory.get_service_runner(
            SocketReaderService, {
                "name": "socket_reader_service",
                "output_endpoint": output_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint(),
                "output_class": StringMessage
            },
            configuration_stream=configuration_stream)

        # start them, wait ten seconds, stop them
        logging.info("starting services")
        socket_writer_service_runner.start()
        socket_reader_service_runner.start()

        time.sleep(5)

        logging.info("Publishing ConfigurationMessage")
        mainline_configuration_endpoint = configuration_stream.get_write_endpoint(
        )
        configuration_message = ConfigurationMessage({
            "socket_writer_service": {
                "host": "localhost",
                "port": "10001"
            },
            "socket_reader_service": {
                "host": "localhost",
                "port": "10001"
            }
        })
        messager.publish(mainline_configuration_endpoint,
                         configuration_message)

        time.sleep(5)

        logging.info("Publishing 'Start' control message")
        mainline_control_endpoint = control_stream.get_write_endpoint()
        messager.publish(mainline_control_endpoint, StringMessage("Start"))

        time.sleep(5)

        mainline_input_endpoint = input_stream.get_write_endpoint()
        mainline_output_endpoint = output_stream.get_read_endpoint()

        logging.info("Publishing messagse to socket writer...")
        messager.publish(mainline_input_endpoint, StringMessage("Message 1"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 2"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 3"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 4"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 5"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 6"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 7"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 8"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 9"))
        messager.publish(mainline_input_endpoint, StringMessage("Message 10"))

        time.sleep(5)

        logging.info("Checking for message at socket reader...")

        for i in range(20):
            message = messager.poll(mainline_output_endpoint)
            if message is None:
                logging.info("No message.")
                time.sleep(1)
            else:
                logging.info("Message is '{}'".format(message.get_payload()))

        logging.info("Publishing 'Stop' control message")
        messager.publish(mainline_control_endpoint, StringMessage("Stop"))

        time.sleep(5)

        logging.info("Stopping services")
        socket_writer_service_runner.terminate()
        socket_reader_service_runner.terminate()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        control_stream = messager.get_stream(messaging_system, "control",
                                             StringMessage)

        service_runner_factory = ServiceRunnerFactory(messager)

        visibility_stream = messager.get_stream(messaging_system, "visibility",
                                                VisibilityDatagram)
        visibility_datagram_source_service_runner = service_runner_factory.get_service_runner(
            VisibilityDatagramSourceService, {
                "name": "visibility_datagram_source_service",
                "visibility_datagram_endpoint":
                visibility_stream.get_endpoint(),
                "control_endpoint": control_stream.get_endpoint()
            },
            configuration_stream=configuration_stream)

        visibility_string_stream = messager.get_stream(messaging_system,
                                                       "visibilitystring",
                                                       StringMessage)
        tostring_service_runner = service_runner_factory.get_service_runner(
            ToStringService, {
                "name": "tostring_service",
                "input_endpoint": visibility_stream.get_endpoint(),
                "output_endpoint": visibility_string_stream.get_endpoint(),
                "control_endpoint": control_stream.get_endpoint()
            },
            configuration_stream=configuration_stream)

        string_writer_service_runner = service_runner_factory.get_service_runner(
            StringWriterService, {
                "name": "string_writer_service",
                "string_endpoint": visibility_string_stream.get_endpoint(),
                "control_endpoint": control_stream.get_endpoint()
            },
            configuration_stream=configuration_stream)

        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        time.sleep(5)

        logging.info("Starting services")
        string_writer_service_runner.start()
        tostring_service_runner.start()
        visibility_datagram_source_service_runner.start()

        time.sleep(5)

        logging.info("Publishing configuration")
        mainline_configuration_endpoint = configuration_stream.get_endpoint()

        configuration_message = ConfigurationMessage({
            "antennas": {
                "ant2": {
                    "name": "ak02",
                    "itrf":
                    (-2556109.976515, 5097388.699862, -2848440.12097248)
                },
                "ant4": {
                    "name": "ak04",
                    "itrf": (-2556087.396082, 5097423.589662, -2848396.867933)
                },
                "ant5": {
                    "name": "ak05",
                    "itrf":
                    (-2556028.607336, 5097451.468188, -2848399.83113161)
                },
                "ant10": {
                    "name": "ak10",
                    "itrf": (-2556059.228687, 5097560.766055, -2848178.119367)
                },
                "ant12": {
                    "name": "ak12",
                    "itrf":
                    (-2556496.237175, 5097333.724901, -2848187.33832738)
                },
                # other to get 12-antennas
                "ant7": {
                    "name": "ak07",
                    "itrf": (-2556282.880670, 5097252.290820, -2848527.104272)
                },
                "ant11": {
                    "name": "ak11",
                    "itrf": (-2556397.233607, 5097421.429903, -2848124.497319)
                },
                # old BETA antennas
                "ant1": {
                    "name": "ak01",
                    "itrf": (-2556084.669, 5097398.337, -2848424.133)
                },
                "ant15": {
                    "name": "ak15",
                    "itrf":
                    (-2555389.850372, 5097664.627578, -2848561.95991566)
                },
                "ant3": {
                    "name": "ak03",
                    "itrf":
                    (-2556118.109261, 5097384.719695, -2848417.19642608)
                },
                "ant6": {
                    "name": "ak06",
                    "itrf":
                    (-2556227.878593, 5097380.442223, -2848323.44598377)
                },
                "ant8": {
                    "name": "ak08",
                    "itrf": (-2556002.509816, 5097320.293832, -2848637.482106)
                },
                "ant9": {
                    "name": "ak09",
                    "itrf": (-2555888.891875, 5097552.280516, -2848324.679547)
                }
            },
            "metadata_source": {
                "host": "localhost",
                "port": "4061",
                "topicmanager": "IceStorm/[email protected]",
                "topic": "metadata",
                "adapter": "IngestPipeline"
            },
            "datagram_source": {
                "host": "localhost",
                "port": "3000"
            },
            "correlation_modes": {
                "standard": {
                    "channel_width": "18.518518",
                    "interval": "5000000",
                    "number_of_channels": "216",
                    "stokes": ["XX", "XY", "YX", "YY"]
                }
            },
            "maximum_number_of_beams":
            "36",
            "string_writer_service.output_path":
            "output.txt"
        })
        messager.publish(mainline_configuration_endpoint,
                         configuration_message)

        logging.info("Starting processing")
        mainline_control_endpoint = control_stream.get_endpoint()

        messager.publish(mainline_control_endpoint, StringMessage("Start"))

        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)
        messager.publish(mainline_control_endpoint, StringMessage("Stop"))

        time.sleep(10)

        visibility_datagram_source_service_runner.terminate()
        tostring_service_runner.terminate()
        string_writer_service_runner.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
示例#8
0
    def test(self):
        self.registry_port = 9000
        registry = ZMQMessagingSystemRegistry(self.registry_port)
        registry.start()

        time.sleep(1)

        logging.info("starting services")

        letter1_thread = threading.Thread(target=self._run_letter1)
        letter1_thread.start()

        letter2_thread = threading.Thread(target=self._run_letter2)
        letter2_thread.start()

        concatenator_thread = threading.Thread(target=self._run_concatenator)
        concatenator_thread.start()

        writer_thread = threading.Thread(target=self._run_writer)
        writer_thread.start()

        monitor_thread = threading.Thread(target=self._run_monitor)
        monitor_thread.start()

        time.sleep(5)

        logging.info("Setting up messaging system")
        messaging_system = ZMQMessagingSystem("localhost", self.registry_port,
                                              9006)
        messager = Messager()
        control_stream = messager.get_stream(messaging_system, "control",
                                             StringMessage)
        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        logging.info("Registering to publish on 'configuration' topic.")
        configuration_endpoint = configuration_stream.get_write_endpoint()
        time.sleep(5)
        logging.info("Publishing ConfigurationMessage")
        configuration_message = ConfigurationMessage({
            "letter1_generator_service.upper":
            True,
            "string_writer_service.output_path":
            "output.txt"
        })
        messager.publish(configuration_endpoint, configuration_message)

        time.sleep(5)
        logging.info("Registering to publish on 'control' topic")
        control_endpoint = control_stream.get_write_endpoint()
        time.sleep(5)
        logging.info("Publishing 'Start' control message")
        messager.publish(control_endpoint, StringMessage("Start"))

        time.sleep(20)

        logging.info("Publishing 'Stop' control message")
        messager.publish(control_endpoint, StringMessage("Stop"))

        time.sleep(5)

        logging.info("Stopping services")
        self.letter1_stopped = True
        self.letter2_stopped = True
        self.concatenator_stopped = True
        self.writer_stopped = True
        self.monitor_stopped = True

        time.sleep(10)

        registry.stop()
示例#9
0
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        configuration_stream = messager.get_stream(messaging_system,
                                                   "configuration",
                                                   ConfigurationMessage)
        control_stream = messager.get_stream(messaging_system, "control",
                                             StringMessage)

        service_runner_factory = ServiceRunnerFactory(messager)

        letter1_stream = messager.get_stream(messaging_system, "letter1",
                                             StringMessage)
        letter1_metrics_stream = messager.get_stream(messaging_system,
                                                     "letter1_metrics",
                                                     Metrics)
        letter1_generator_service_runner = service_runner_factory.get_service_runner(
            LetterGeneratorService, {
                "name": "letter1_generator_service",
                "endpoint": letter1_stream.get_write_endpoint()
            },
            configuration_stream=configuration_stream,
            metrics_stream=letter1_metrics_stream)

        letter2_stream = messager.get_stream(messaging_system, "letter2",
                                             StringMessage)
        letter2_metrics_stream = messager.get_stream(messaging_system,
                                                     "letter2_metrics",
                                                     Metrics)
        letter2_generator_service_runner = service_runner_factory.get_service_runner(
            LetterGeneratorService, {
                "name": "letter2_generator_service",
                "endpoint": letter2_stream.get_write_endpoint()
            },
            configuration_stream=configuration_stream,
            metrics_stream=letter2_metrics_stream)

        concatenation_stream = messager.get_stream(messaging_system,
                                                   "concatenation",
                                                   StringMessage)
        concatenator_metrics_stream = messager.get_stream(
            messaging_system, "concatenator_metrics", Metrics)
        string_concatenator_service_runner = service_runner_factory.get_service_runner(
            StringConcatenatorService, {
                "name": "string_concatenator_service",
                "first_endpoint": letter1_stream.get_read_endpoint(),
                "second_endpoint": letter2_stream.get_read_endpoint(),
                "concatenation_endpoint":
                concatenation_stream.get_write_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            configuration_stream=configuration_stream,
            metrics_stream=concatenator_metrics_stream)

        writer_metrics_stream = messager.get_stream(messaging_system,
                                                    "writer_metrics", Metrics)
        string_writer_service_runner = service_runner_factory.get_service_runner(
            StringWriterService, {
                "name": "string_writer_service",
                "string_endpoint": concatenation_stream.get_read_endpoint(),
                "control_endpoint": control_stream.get_read_endpoint()
            },
            configuration_stream=configuration_stream,
            metrics_stream=writer_metrics_stream)

        monitor_service = GenericMonitorService("generic_monitor_service", [
            letter1_metrics_stream.get_read_endpoint(),
            letter2_metrics_stream.get_read_endpoint(),
            concatenator_metrics_stream.get_read_endpoint(),
            writer_metrics_stream.get_read_endpoint()
        ])
        monitor_service_runner = ServiceRunner(monitor_service, messager)

        # start them, wait ten seconds, stop them
        logging.info("starting services")
        monitor_service_runner.start()
        string_writer_service_runner.start()
        string_concatenator_service_runner.start()
        letter1_generator_service_runner.start()
        letter2_generator_service_runner.start()

        time.sleep(5)

        logging.info("Publishing ConfigurationMessage")
        mainline_configuration_endpoint = configuration_stream.get_write_endpoint(
        )
        configuration_message = ConfigurationMessage({
            "letter1_generator_service.upper":
            True,
            "string_writer_service.output_path":
            "output.txt"
        })
        messager.publish(mainline_configuration_endpoint,
                         configuration_message)

        time.sleep(5)

        mainline_control_endpoint = control_stream.get_write_endpoint()

        logging.info("Publishing 'Start' control message")
        messager.publish(mainline_control_endpoint, StringMessage("Start"))

        time.sleep(5)

        logging.info("Publishing 'Stop' control message")
        messager.publish(mainline_control_endpoint, StringMessage("Stop"))

        time.sleep(5)

        logging.info("Stopping services")
        letter1_generator_service_runner.terminate()
        letter2_generator_service_runner.terminate()
        string_concatenator_service_runner.terminate()
        string_writer_service_runner.terminate()
        monitor_service_runner.terminate()