Esempio n. 1
0
        static void Main(string[] args)
        {
            Amqp.Trace.TraceLevel    = Amqp.TraceLevel.Frame | Amqp.TraceLevel.Verbose;
            Amqp.Trace.TraceListener = (f, a) => Debug.Print(DateTime.Now.ToString("[hh:ss.fff]") + " " + Fx.Format(f, a));

            Scenarios scenarios = new Scenarios();

            scenarios.ConnectionString = SB_CONNECTION_STRING;

            scenarios.Scenario1_EventHubSend(EVENT_HUB_NAME);

            scenarios.Scenario2_EventHubSendToPartition(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_ID);

            scenarios.Scenario3_EventHubSendToPublisher(
                EVENT_HUB_NAME,
                EVENT_HUB_PUBLISHER_NAME);

            scenarios.Scenario4_EventHubSendToPublisherWithToken(
                SB_NAMESPACE,
                EVENT_HUB_NAME,
                EVENT_HUB_PUBLISHER_NAME,
                SHARED_ACCESS_KEY_NAME,
                SHARED_ACCESS_KEY);

            scenarios.Scenario5_EventHubSendToPartitionKey(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_KEY);

            scenarios.Scenario6_EventHubReceiveFromPartition(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_ID);

            scenarios.Scenario7_EventHubReceiveFromPartitionOffset(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_ID,
                EVENT_HUB_PARTITION_OFFSET);

            scenarios.Scenario8_EventHubReceiveFromPartitionDateTimeOffset(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_ID,
                EVENT_HUB_PARTITION_DATE_TIME_OFFSET);

            scenarios.Scenario9_QueueSend(QUEUE_SEND);

            scenarios.Scenario10_QueueRequestResponse(
                QUEUE_SEND,
                QUEUE_REPLYTO);

            scenarios.Scenario12_TopicSend(
                TOPIC_SEND,
                SUBSCRIPTION_ONE,
                SUBSCRIPTION_TWO);

            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Amqp.Trace.TraceLevel    = Amqp.TraceLevel.Frame | Amqp.TraceLevel.Verbose;
            Amqp.Trace.TraceListener = (f, a) => Debug.Print(DateTime.Now.ToString("[hh:ss.fff]") + " " + Fx.Format(f, a));

            Microsoft.SPOT.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
            Microsoft.SPOT.Net.NetworkInformation.NetworkChange.NetworkAddressChanged      += NetworkChange_NetworkAddressChanged;

            networkAvailableEvent.WaitOne();
            Debug.Print("link is up!");
            networkAddressChangedEvent.WaitOne();
            Debug.Print("address acquired: " + Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress);

            Debug.Print("\r\n*** GET NETWORK INTERFACE SETTINGS ***");
            Microsoft.SPOT.Net.NetworkInformation.NetworkInterface[] networkInterfaces = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
            Debug.Print("Found " + networkInterfaces.Length + " network interfaces.");

            Scenarios scenarios = new Scenarios();

            scenarios.ConnectionString = SB_CONNECTION_STRING;

            scenarios.Scenario1_EventHubSend(EVENT_HUB_NAME);

            scenarios.Scenario2_EventHubSendToPartition(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_ID);

            scenarios.Scenario3_EventHubSendToPublisher(
                EVENT_HUB_NAME,
                EVENT_HUB_PUBLISHER_NAME);

            scenarios.Scenario4_EventHubSendToPublisherWithToken(
                SB_NAMESPACE,
                EVENT_HUB_NAME,
                EVENT_HUB_PUBLISHER_NAME,
                SHARED_ACCESS_KEY_NAME,
                SHARED_ACCESS_KEY);

            scenarios.Scenario5_EventHubSendToPartitionKey(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_KEY);

            scenarios.Scenario6_EventHubReceiveFromPartition(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_ID);

            scenarios.Scenario7_EventHubReceiveFromPartitionOffset(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_ID,
                EVENT_HUB_PARTITION_OFFSET);

            scenarios.Scenario8_EventHubReceiveFromPartitionDateTimeOffset(
                EVENT_HUB_NAME,
                EVENT_HUB_PARTITION_ID,
                EVENT_HUB_PARTITION_DATE_TIME_OFFSET);

            scenarios.Scenario9_QueueSend(QUEUE_SEND);

            scenarios.Scenario10_QueueRequestResponse(
                QUEUE_SEND,
                QUEUE_REPLYTO);

            scenarios.Scenario12_TopicSend(
                TOPIC_SEND,
                SUBSCRIPTION_ONE,
                SUBSCRIPTION_TWO);

            Thread.Sleep(Timeout.Infinite);
        }