void HandleConnected(AmqpClient clientParam)
    {
        exchangeSubscription = new AmqpExchangeSubscription(responseExchange, responExchangeType, responseRoutingKey, HandleExchangeMassageRecieved);
        AmqpClient.Subscribe(exchangeSubscription);

        serverTerhubung = true;
    }
    // subscribe to rabbitmq exchange if connection is successful
    void HandleConnected(AmqpClient clientParam)
    {
        // subscribe to exchange for listening response's purpose
        exchangeSubscription = new AmqpExchangeSubscription(responseExchangeName, responseExchangeType, responseRoutingKey, HandleExchangeMessageReceived);
        AmqpClient.Subscribe(exchangeSubscription);

        serverConnected = true;
    }
Exemple #3
0
        public void Subscribe()
        {
            var subscription = new UnityAmqpExchangeSubscription(
                txtexcname.text, AmqpExchangeTypes.Topic, txtroutkey.text,
                null, AmqpClient.Instance.UnityEventDebugExhangeMessageHandler);

            // Subscribe on the client
            AmqpClient.Subscribe(subscription);
        }
        /// <summary>
        /// Subscribes to the AMQP exchange subscription using the form's values.
        /// </summary>
        public void Subscribe()
        {
            // Validate args
            var isValid = true;

            var exchangeName = ExchangeName.options[ExchangeName.value].text;

            if (string.IsNullOrEmpty(exchangeName))
            {
                isValid           = false;
                AmqpConsole.Color = Color.red;
                AmqpConsole.WriteLine("* Exchange Name cannot be blank");
                AmqpConsole.Color = null;
            }

            // Don't continue if values are invald
            if (!isValid)
            {
                return;
            }

            var exchangeType = AmqpExchangeTypes.Direct;

            // Find this exchange and get its exchange type
            foreach (var exchange in exchanges)
            {
                if (exchange.Name == exchangeName)
                {
                    exchangeType = exchange.Type;
                    break;
                }
            }

            var routingKey = RoutingKey.text;

            // Ensure this subscription doesn't already exist
            foreach (var sub in exSubscriptions)
            {
                if (sub.ExchangeName == exchangeName && sub.ExchangeType == exchangeType && sub.RoutingKey == routingKey)
                {
                    AmqpConsole.Color = new Color(1f, 0.5f, 0);
                    AmqpConsole.WriteLineFormat("Subscription already exists for exchange {0}:{1}", exchangeName, routingKey);
                    AmqpConsole.Color = null;
                    return;
                }
            }

            // Create the new subscription
            var subscription = new UnityAmqpExchangeSubscription(exchangeName, exchangeType, routingKey, null, AmqpClient.Instance.UnityEventDebugExhangeMessageHandler);

            // Subscribe on the client
            AmqpClient.Subscribe(subscription);
        }
        void Start()
        {
            var queue = new AmqpQueueSubscription(QueueName, false, HandleQueueMessageReceived);

            AmqpClient.Subscribe(queue);
            Debug.Log("Subscribe");

            _baggageGarage  = Map.GetLocation("BaggageGarage").Value;
            _busGarage      = Map.GetLocation("BusGarage").Value;
            _followMeGarage = Map.GetLocation("FollowMeGarage").Value;
            _fuelGarage     = Map.GetLocation("FuelGarage").Value;
        }
        // *Note*: Only interact with the AMQP library in Start(), not Awake()
        // since the AmqpClient initializes itself in Awake() and won't be ready yet.
        void Start()
        {
            // Create a new exchange subscription using the inspector values
            var subscription = new AmqpExchangeSubscription(ExchangeName, ExchangeType, RoutingKey, HandleExchangeMessageReceived);

            /*
             * Add the subscription to the client. If you are using multiple AmqpClient instances then
             * using the static methods won't work. In that case add a inspector property of type 'AmqpClient'
             * and assigned a reference to the connection you want to work with and call the 'SubscribeToExchange()'
             * non-static method instead.
             */
            AmqpClient.Subscribe(subscription);
        }
Exemple #7
0
        // *Note*: Only interact with the AMQP library in Start(), not Awake()
        // since the AmqpClient initializes itself in Awake() and won't be ready yet.
        public override void Start()
        {
            // Create a new exchange subscription using the inspector values
            var Input_subscription = new AmqpExchangeSubscription(ExchangeName, ExchangeType, InputRoutingKey, HandleInputMessageReceived);

            //var Output_subscription = new AmqpExchangeSubscription(ExchangeName, ExchangeType, OutputRoutingKey, HandleInputMessageReceived);

            /*
             * Add the subscription to the client. If you are using multiple AmqpClient instances then
             * using the static methods won't work. In that case add a inspector property of type 'AmqpClient'
             * and assigned a reference to the connection you want to work with and call the 'SubscribeToExchange()'
             * non-static method instead.
             */
            AmqpClient.Subscribe(Input_subscription);
            Debug.LogFormat("Anttena subscribed to {0}", Input_subscription);
        }
Exemple #8
0
        public void SubscribeQueue()
        {
            Debug.Log("SubscribeQueue");
            var queueName = SubscribeQueueName.text;

            // Ensure this subscription doesn't already exist
            foreach (var sub in queueSubscriptions)
            {
                if (sub.QueueName == queueName)
                {
                    AmqpConsole.Color = new Color(1f, 0.5f, 0);
                    AmqpConsole.WriteLineFormat("Subscription already exists for queue {0}", queueName);
                    AmqpConsole.Color = null;
                    return;
                }
            }

            var subscription = new UnityAmqpQueueSubscription(SubscribeQueueName.text, true, null,
                                                              UnityEventDebugQueueMessageHandler);

            AmqpClient.Subscribe(subscription);
        }
Exemple #9
0
        // *Note*: Only interact with the AMQP library in Start(), not Awake()
        // since the AmqpClient initializes itself in Awake() and won't be ready yet.
        public override void Start()
        {
            InputRoutingKey        = ExchangeName + ".Input." + MyId;
            OutputRoutingKey       = ExchangeName + ".Output." + MyId;
            inputInfo.ID           = MyId;
            inputInfo.HeardMessage = new List <int>(new int[] { 0, 0 });;


            // Create a new exchange subscription using the inspector values
            //var Output_subscription = new AmqpExchangeSubscription(ExchangeName, ExchangeType, OutputRoutingKey, HandleInputMessageReceived);

            /*
             * Add the subscription to the client. If you are using multiple AmqpClient instances then
             * using the static methods won't work. In that case add a inspector property of type 'AmqpClient'
             * and assigned a reference to the connection you want to work with and call the 'SubscribeToExchange()'
             * non-static method instead.
             */
            AmqpClient.Subscribe(new AmqpExchangeSubscription(ExchangeName, ExchangeType, InputRoutingKey, HandleInputMessageReceived));
            //Debug.LogFormat("subscribed to {0}", Input_subscription);

            CentralBus.HeardMessage.AddListener(HeardMessage);
        }
Exemple #10
0
    // Start is called before the first frame update
    void Start()
    {
        var subscription = new AmqpExchangeSubscription(ExchangeName, ExchangeType, RoutingKey, HandleMessageReceived);

        AmqpClient.Subscribe(subscription);
    }