// *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); }
// Constructor public AmqpExchangeReceivedMessage(AmqpExchangeSubscription subscription, IAmqpReceivedMessage message) { if (subscription == null) { throw new ArgumentNullException("subscription"); } if (message == null) { throw new ArgumentNullException("message"); } Subscription = subscription; Message = message; }
// *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); }