示例#1
0
 public LBMRcvReceiver(bool verbose, bool end_on_eos, bool summary)
 {
     _verbose    = verbose;
     _end_on_eos = end_on_eos;
     _summary    = summary;
     LBMReceiverCallback cb = new LBMReceiverCallback(onReceive);
 }
示例#2
0
    static void Main(String[] args)
    {
        LBMContext ctx = null;           /* Context object: container for UM "instance". */
                LBMReceiver rcv = null;          /* Receiver object: for receiving messages. */
                LBMTopic rtopic = null;          /* Topic object */
                LBMReceiverAttributes rcv_attr;  /* Receiver attribute object */

                /* Initialize and create receiver and receiver callback */
                LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive);

                /*** Initialization: create necessary UM objects. ***/
                ctx = new LBMContext();

                rcv_attr = new LBMReceiverAttributes();
                rcv_attr.setValue("resolution_no_source_notification_threshold", noSourceQueries);

                rtopic = new LBMTopic(ctx, "test.topic", rcv_attr);
                rcv = new LBMReceiver(ctx, rtopic, myReceiverCallback, null);

                while(noSource == 0) {
                    try
                    {
                        System.Threading.Thread.Sleep(1000);
                    }
                    catch (Exception eex)
                    {
                        System.Console.Error.WriteLine("Error Thread.sleep interrupted: " + eex.Message);
                        System.Environment.Exit(1);
                    }
                }

                rcv.close();
                ctx.close();
    }
示例#3
0
    static void Main(String[] args)
    {
        LBMContext ctx = null;           /* Context object: container for UM "instance". */
                LBMReceiver rcv = null;          /* Receiver object: for receiving messages. */
                LBMTopic rtopic = null;          /* Topic object */
                LBMReceiverAttributes rcv_attr;  /* Receiver attribute object */

                /* Initialize and create receiver and receiver callback */
                LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive);

                /*** Initialization: create necessary UM objects. ***/
                ctx = new LBMContext();
                rcv_attr = new LBMReceiverAttributes();

                UMERcvRecInfo umerecinfocb = new UMERcvRecInfo();
                rcv_attr.setRecoverySequenceNumberCallback(umerecinfocb.setRecoverySequenceNumberInfo, null);

                rtopic = new LBMTopic(ctx, "test.topic", rcv_attr);
                rcv = new LBMReceiver(ctx, rtopic, myReceiverCallback, null);

                while(true)
                {

                }
    }
示例#4
0
    public static void Main(String[] args)
    {
        /* Initialization: create necessary UM objects. */
        LBMContext ctx = new LBMContext();

        /* Create LBMReceiverCallback using the method onReceive defined in this class */
        LBMReceiverCallback rcvCallback = new LBMReceiverCallback(onReceive);

        /* Create receiver objects */
        LBMReceiverAttributes rcv_attr = new LBMReceiverAttributes();
        LBMTopic    rtopic             = new LBMTopic(ctx, "test.topic", rcv_attr);
        LBMReceiver rcv = new LBMReceiver(ctx, rtopic, rcvCallback, null, null);

        /* Initialize and create source */
        LBMTopic  stopic = new LBMTopic(ctx, "test.topic", new LBMSourceAttributes());
        LBMSource src    = new LBMSource(ctx, stopic);

        String msgData = "request";

        byte[] bytes = new byte[msgData.Length * sizeof(char)];
        System.Buffer.BlockCopy(msgData.ToCharArray(), 0, bytes, 0, bytes.Length);

        LBMRequest          req = new LBMRequest(bytes, bytes.Length);
        LBMResponseCallback myResponseCallback = new LBMResponseCallback(onResponse);

        req.addResponseCallback(myResponseCallback);

        /* Sleep for 1 second to allow TR to complete */
        try
        {
            System.Threading.Thread.Sleep(1000);
        }
        catch (Exception ex)
        {
            System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception:  " + ex.Message);
            System.Environment.Exit(1);
        }

        /* Send a message. */
        src.send(req, LBM.MSG_FLUSH | LBM.SRC_BLOCK);

        while (run == 1)
        {
            try
            {
                System.Threading.Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception:  " + ex.Message);
                System.Environment.Exit(1);
            }
        }

        /* Cleanup: delete UM objects. */
        req.close();
        src.close();
        rcv.close();
        ctx.close();
    }  /* main */
示例#5
0
    static void Main(String[] args)
    {
        LBMContext            ctx    = null;     /* Context object: container for UM "instance". */
        LBMReceiver           rcv    = null;     /* Receiver object: for receiving messages. */
        LBMTopic              rtopic = null;     /* Topic object */
        LBMReceiverAttributes rcv_attr;          /* Receiver attribute object */

        /* Initialize and create receiver and receiver callback */
        LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive);

        /*** Initialization: create necessary UM objects. ***/
        ctx = new LBMContext();

        rcv_attr = new LBMReceiverAttributes();
        rcv_attr.setValue("resolution_no_source_notification_threshold", noSourceQueries);

        rtopic = new LBMTopic(ctx, "test.topic", rcv_attr);
        rcv    = new LBMReceiver(ctx, rtopic, myReceiverCallback, null);

        while (noSource == 0)
        {
            try
            {
                System.Threading.Thread.Sleep(1000);
            }
            catch (Exception eex)
            {
                System.Console.Error.WriteLine("Error Thread.sleep interrupted: " + eex.Message);
                System.Environment.Exit(1);
            }
        }

        rcv.close();
        ctx.close();
    }     /* main */
示例#6
0
    static void Main(String[] args)
    {
        LBMContext            ctx    = null;     /* Context object: container for UM "instance". */
        LBMReceiver           rcv    = null;     /* Receiver object: for receiving messages. */
        LBMTopic              rtopic = null;     /* Topic object */
        LBMReceiverAttributes rcv_attr;          /* Receiver attribute object */

        /* Initialize and create receiver and receiver callback */
        LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive);

        /*** Initialization: create necessary UM objects. ***/
        ctx      = new LBMContext();
        rcv_attr = new LBMReceiverAttributes();

        UMERcvRecInfo umerecinfocb = new UMERcvRecInfo();

        rcv_attr.setRecoverySequenceNumberCallback(umerecinfocb.setRecoverySequenceNumberInfo, null);

        rtopic = new LBMTopic(ctx, "test.topic", rcv_attr);
        rcv    = new LBMReceiver(ctx, rtopic, myReceiverCallback, null);

        while (true)
        {
        }
    }     /* main */
示例#7
0
    public static void main(String[] args)
    {
        /* Initialization: create necessary UM objects. */
        LBMContext ctx = new LBMContext();

        /* Create LBMReceiverCallback using the method onReceive defined in this class */
        LBMReceiverCallback rcvCallback = new LBMReceiverCallback(onReceive);

        /* Create receiver objects */
        LBMReceiverAttributes rcv_attr = new LBMReceiverAttributes();
        LBMTopic rtopic = new LBMTopic(ctx, "test.topic", rcv_attr);
        LBMReceiver rcv = new LBMReceiver(ctx, rtopic, rcvCallback, null, null);

        /* Initialize and create source */
        LBMTopic stopic = new LBMTopic(ctx, "test.topic", new LBMSourceAttributes());
        LBMSource src = new LBMSource(ctx, stopic);

        String msgData = "request";
        byte[] bytes = new byte[msgData.Length * sizeof(char)];
        System.Buffer.BlockCopy(msgData.ToCharArray(), 0, bytes, 0, bytes.Length);

        LBMRequest req = new LBMRequest(bytes, bytes.Length);
        LBMResponseCallback myResponseCallback = new LBMResponseCallback(onResponse);
        req.addResponseCallback(myResponseCallback);

        /* Sleep for 1 second to allow TR to complete */
        try
        {
            System.Threading.Thread.Sleep(1000);
        }
        catch (Exception ex)
        {
            System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception:  " + ex.Message);
            System.Environment.Exit(1);
        }

        /* Send a message. */
        src.send(req, LBM.MSG_FLUSH | LBM.SRC_BLOCK);

        while (run == 1)
        {
            try
            {
                System.Threading.Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception:  " + ex.Message);
                System.Environment.Exit(1);
            }
        }

        /* Cleanup: delete UM objects. */
        req.close();
        src.close();
        rcv.close();
        ctx.close();
    }
示例#8
0
        public LBMRcvReceiver(bool verbose, bool end_on_eos, bool summary, LBMObjectRecyclerBase objRec)
        {
            _verbose    = verbose;
            _end_on_eos = end_on_eos;
            _summary    = summary;
            LBMReceiverCallback cb = new LBMReceiverCallback(onReceive);

            _recycler = objRec;
        }
示例#9
0
    static void Main(String[] args)
    {
        LBMContext          ctx       = null;                               /* Context object: container for UM "instance". */
        LBMReceiver         lateRcv   = null;                               /* Receiver object: for sending messages. */
        LBMReceiverCallback cb        = new LBMReceiverCallback(onReceive); /* Wrapping the onReceive functor in a callback */
        LBMSource           early_src = null;                               /* Source object: for sending messages. */

        ctx = new LBMContext();


        try
        {
            LBMTopic            srcTopic = null;
            LBMSourceAttributes srcAttr  = null;

            srcAttr = new LBMSourceAttributes();

            srcAttr.setValue("late_join", "1");
            srcAttr.setValue("retransmit_retention_size_threshold", "1");

            srcTopic  = ctx.allocTopic("test.topic", srcAttr);
            early_src = new LBMSource(ctx, srcTopic);

            early_src.send(Encoding.ASCII.GetBytes("test"), 4, LBM.MSG_FLUSH | LBM.SRC_NONBLOCK);
        }
        catch (LBMException ex)
        {
            System.Console.Error.WriteLine("Error initializing LBM objects:  " + ex.Message);
            System.Environment.Exit(1);
        }

        {
            LBMTopic topic = null;
            topic = ctx.lookupTopic("test.topic");

            lateRcv = new LBMReceiver(ctx, topic, onReceive, null, null);
        }

        Thread.Sleep(100);

        try {
            early_src.close();
            lateRcv.close();
            ctx.close();
        }
        catch (LBMException ex)
        {
            System.Console.Error.WriteLine("Error closing LBM objects: " + ex.Message);
            System.Environment.Exit(1);
        }
    }
示例#10
0
    static void Main(String[] args)
    {
        LBMContext ctx = null;      /* Context object: container for UM "instance". */
        LBMReceiver lateRcv = null; /* Receiver object: for sending messages. */
        LBMReceiverCallback cb = new LBMReceiverCallback(onReceive);    /* Wrapping the onReceive functor in a callback */
        LBMSource early_src = null;   /* Source object: for sending messages. */

        ctx = new LBMContext();

        try
        {
            LBMTopic srcTopic = null;
            LBMSourceAttributes srcAttr = null;

            srcAttr = new LBMSourceAttributes();

            srcAttr.setValue("late_join", "1");
            srcAttr.setValue("retransmit_retention_size_threshold", "1");

            srcTopic = ctx.allocTopic("test.topic", srcAttr);
            early_src = new LBMSource(ctx, srcTopic);

            early_src.send(Encoding.ASCII.GetBytes("test"), 4, LBM.MSG_FLUSH | LBM.SRC_NONBLOCK);
        }
        catch (LBMException ex)
        {
            System.Console.Error.WriteLine("Error initializing LBM objects:  " + ex.Message);
            System.Environment.Exit(1);
        }

        {
            LBMTopic topic = null;
            topic = ctx.lookupTopic("test.topic");

            lateRcv = new LBMReceiver(ctx, topic, onReceive, null, null);
        }

        Thread.Sleep(100);

        try {
            early_src.close();
            lateRcv.close();
            ctx.close();
        }
        catch(LBMException ex)
        {
            System.Console.Error.WriteLine("Error closing LBM objects: " + ex.Message);
            System.Environment.Exit(1);
        }
    }
    static void Main(String[] args)
    {
        LBMContext  ctx    = null;               /* Context object: container for UM "instance". */
        LBMReceiver rcv    = null;               /* Receiver object: for receiving messages. */
        LBMTopic    rtopic = null;               /* Topic object */

        /* Initialize and create receiver and receiver callback */
        LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive);

        /*** Initialization: create necessary UM objects. ***/
        ctx = new LBMContext();

        rtopic = new LBMTopic(ctx, "test.topic");
        rcv    = new LBMReceiver(ctx, rtopic, myReceiverCallback, null);

        while (true)
        {
        }
    }     /* main */
示例#12
0
    static void Main(String[] args)
    {
        LBMContext ctx = null;           /* Context object: container for UM "instance". */
                LBMReceiver rcv = null;          /* Receiver object: for receiving messages. */
                LBMTopic rtopic = null;          /* Topic object */

                /* Initialize and create receiver and receiver callback */
                LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive);

                /*** Initialization: create necessary UM objects. ***/
                ctx = new LBMContext();

                rtopic = new LBMTopic(ctx, "test.topic");
                rcv = new LBMReceiver(ctx, rtopic, myReceiverCallback, null);

                while(true)
                {

                }
    }
示例#13
0
    static void Main(String[] args)
    {
        LBMContext          ctx = null;                               /* Context object: container for UM "instance". */
        LBMReceiver         rcv = null;                               /* Source object: for sending messages. */
        LBMEventQueue       evq = null;                               /* Event Queue object: process receiver events on app thread */
        LBMReceiverCallback cb  = new LBMReceiverCallback(onReceive); /* Wrapping the onReceive functor in a callback */

        ctx = new LBMContext();
        evq = new LBMEventQueue();
        {
            LBMTopic topic = null;
            topic = ctx.lookupTopic("test.topic");

            /* The event queue object is passed into the receiver constructor */
            /* This causes events to be queued in an unbounded Q.  In order   */
            /* to process these messages the evq.Run() method must be called  */
            rcv = new LBMReceiver(ctx, topic, onReceive, null, evq);
        }


        /* run the event queue for 60 seconds           */
        /* all the receiver events will be processed    */
        /* in this thread. This includes message        */
        /* processing.							        */
        evq.run(60000);

        try {
            /* Shutdown order is important.  Event Queues should */
            /* be .close()d after the context and receiver.      */
            rcv.close();
            ctx.close();
            evq.close();
        }
        catch (LBMException ex)
        {
            System.Console.Error.WriteLine("Error closing LBM objects: " + ex.Message);
            System.Environment.Exit(1);
        }
    }
示例#14
0
    static void Main(String[] args)
    {
        LBMContext ctx = null; /* Context object: container for UM "instance". */
        LBMReceiver rcv = null; /* Source object: for sending messages. */
        LBMEventQueue evq = null; /* Event Queue object: process receiver events on app thread */
        LBMReceiverCallback cb = new LBMReceiverCallback(onReceive);    /* Wrapping the onReceive functor in a callback */

        ctx = new LBMContext();
        evq = new LBMEventQueue();
        {
            LBMTopic topic = null;
            topic = ctx.lookupTopic("test.topic");

            /* The event queue object is passed into the receiver constructor */
            /* This causes events to be queued in an unbounded Q.  In order   */
            /* to process these messages the evq.Run() method must be called  */
            rcv = new LBMReceiver(ctx, topic, onReceive, null, evq);
        }

        /* run the event queue for 60 seconds         	*/
        /* all the receiver events will be processed  	*/
        /* in this thread. This includes message 		*/
        /* processing.							  		*/
        evq.run(60000);

        try {
            /* Shutdown order is important.  Event Queues should */
            /* be .close()d after the context and receiver.      */
            rcv.close();
            ctx.close();
            evq.close();
        }
        catch(LBMException ex)
        {
            System.Console.Error.WriteLine("Error closing LBM objects: " + ex.Message);
            System.Environment.Exit(1);
        }
    }
示例#15
0
    static void Main(String[] args)
    {
        LBMContext ctx = null; /* Context object: container for UM "instance". */
                LBMEventQueue evq = new LBMEventQueue();

                /* Initialization: create necessary UM objects. */
                try {
                        LBMContextAttributes ctxAttr = new LBMContextAttributes();
                        ctx = new LBMContext(ctxAttr);
                }
                catch(LBMException ex)
                {
                        System.Console.Error.WriteLine("Error initializing LBM objects: " + ex.Message);
                        System.Environment.Exit(1);
                }

                /* Initialize and create receiver and receiver callback */
                LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive);

                LBMReceiverAttributes rcv_attr = new LBMReceiverAttributes();
                LBMTopic rtopic = new LBMTopic(ctx, "test.topic", rcv_attr);
                LBMReceiver rcv = new LBMReceiver(ctx, rtopic, myReceiverCallback, evq);

                /* Initialize and create source */
                LBMTopic stopic = new LBMTopic(ctx, "test.topic", new LBMSourceAttributes());
                LBMSource src = new LBMSource(ctx, stopic);

                EQThread evqThread = new EQThread(evq);
                evqThread.start();

                try
                {
                    System.Threading.Thread.Sleep(1000);
                }
                catch (Exception eex)
                {
                    System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception:  " + eex.Message);
                    System.Environment.Exit(1);
                }

                src.send(Encoding.ASCII.GetBytes("hello"), 5, LBM.MSG_FLUSH);

                while (cleanup == 0)
                {
                    try
                    {
                        System.Threading.Thread.Sleep(1000);
                    }
                    catch (Exception eex)
                    {
                        System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception:  " + eex.Message);
                        System.Environment.Exit(1);
                    }
                }

                evq.stop();
                evqThread.join();

                src.close();
                rcv.close();
                ctx.close();
                evq.close();
    }
示例#16
0
    static void Main(String[] args)
    {
        LBMContext    ctx = null; /* Context object: container for UM "instance". */
        LBMEventQueue evq = new LBMEventQueue();

        /* Initialization: create necessary UM objects. */
        try
        {
            LBMContextAttributes ctxAttr = new LBMContextAttributes();
            ctx = new LBMContext(ctxAttr);
        }
        catch (LBMException ex)
        {
            System.Console.Error.WriteLine("Error initializing LBM objects: " + ex.Message);
            System.Environment.Exit(1);
        }

        /* Initialize and create receiver and receiver callback */
        LBMReceiverCallback myReceiverCallback = new LBMReceiverCallback(onReceive);

        LBMReceiverAttributes rcv_attr = new LBMReceiverAttributes();
        LBMTopic    rtopic             = new LBMTopic(ctx, "test.topic", rcv_attr);
        LBMReceiver rcv = new LBMReceiver(ctx, rtopic, myReceiverCallback, evq);

        /* Initialize and create source */
        LBMTopic  stopic = new LBMTopic(ctx, "test.topic", new LBMSourceAttributes());
        LBMSource src    = new LBMSource(ctx, stopic);

        EQThread evqThread = new EQThread(evq);

        evqThread.start();

        try
        {
            System.Threading.Thread.Sleep(1000);
        }
        catch (Exception eex)
        {
            System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception:  " + eex.Message);
            System.Environment.Exit(1);
        }

        src.send(Encoding.ASCII.GetBytes("hello"), 5, LBM.MSG_FLUSH);

        while (cleanup == 0)
        {
            try
            {
                System.Threading.Thread.Sleep(1000);
            }
            catch (Exception eex)
            {
                System.Console.Error.WriteLine("Error System.Threading.Thread.Sleep() exception:  " + eex.Message);
                System.Environment.Exit(1);
            }
        }

        evq.stop();
        evqThread.join();

        src.close();
        rcv.close();
        ctx.close();
        evq.close();
    } /* main */