Beispiel #1
0
        public consumer_queue(ReaderWriterLockSlim rwl, message_factory_base message_factory_, IModel model, bool Save_raw_data_on_wire_, TimeSpan?Idle_timeout)
            : base(model)
        {
            this.rwl                   = rwl;
            message_factory            = message_factory_;
            this.Save_raw_data_on_wire = Save_raw_data_on_wire_;
            this.Idle_timeout          = Idle_timeout;

            // Todo: move to user/app/client level code!
            //var Maximum_concurrency = Environment.ProcessorCount * 2;
            //ThreadPool.SetMaxThreads(Maximum_concurrency, Maximum_concurrency);
        }
Beispiel #2
0
        public synapse_client(message_factory_base message_factory_, string server_host = "localhost", int server_port = 5672)
        {
            message_factory = message_factory_;

            // AMQP connection
            factory          = new ConnectionFactory();
            factory.HostName = server_host;
            factory.Port     = server_port;
            conn             = factory.CreateConnection();
            ch             = conn.CreateModel();
            conn.AutoClose = true;
            consumer       = new QueueingBasicConsumer(ch);
        }
Beispiel #3
0
        subscribe(ReaderWriterLockSlim rwl, message_factory_base message_factory, string topic_name, ulong begin_utc = 0, ulong end_utc = 0, ulong delayed_delivery_tolerance = 0, bool supply_metadata = false, bool tcp_no_delay = false, bool preroll_if_begin_timestamp_in_future = false, bool Save_raw_data_on_wire = false, TimeSpan?Idle_timeout = null)
        {
            if (consumer == null)
            {
                consumer = new consumer_queue <WaypointsType>(rwl, message_factory, ch, Save_raw_data_on_wire, Idle_timeout);
            }
            var dictionary = new Dictionary <string, object>();

            // currently 'l' in RabbitMQ is chosen as signed type (not the same in other language AMQP libs)... so our interface/API/and-server-side is uint64_t and then each lib/language/implementation casts as necessary (timestamping is under 63 bits at the moment at the server side anyways)

            if (begin_utc != 0)
            {
                dictionary.Add("begin_timestamp", (long)begin_utc);
            }

            if (end_utc != 0)
            {
                dictionary.Add("end_timestamp", (long)end_utc);
            }

            if (delayed_delivery_tolerance != 0)
            {
                dictionary.Add("delayed_delivery_tolerance", (long)delayed_delivery_tolerance);
            }

            if (supply_metadata == true)
            {
                dictionary.Add("supply_metadata", (int)1);
            }

            if (tcp_no_delay == true)
            {
                dictionary.Add("tcp_no_delay", (int)1);
            }

            if (preroll_if_begin_timestamp_in_future == true)
            {
                dictionary.Add("preroll_if_begin_timestamp_in_future", (int)1);
            }

            // not too fast at the moment (bare bones example), TODO later will set topic_name elsewhere so as not to resend it everytime
            ch.BasicConsume(topic_name, true, "", dictionary, consumer);
        }