CymaticLabs / Unity3D.Amqp

AMQP client library for Unity 3D supporting RabbitMQ
MIT License
96 stars 21 forks source link

"Exchanges cannot be declared when disconnected" #6

Open borogove opened 7 years ago

borogove commented 7 years ago

After connecting to the broker, and receiving a list of existing exchanges, I try to declare a new direct exchange:

    AmqpClient.DeclareExchange( "session.default.actuator", AmqpExchangeTypes.Direct ); 

And immediately get this exception:

InvalidOperationException: Exchanges cannot be declared when disconnected
CymaticLabs.Unity3D.Amqp.RabbitMq.RabbitMqBrokerConnection.DeclareExchange (System.String name, AmqpExchangeTypes type, Boolean durable, Boolean autoDelete, IDictionary`2 args)
CymaticLabs.Unity3D.Amqp.AmqpClient.DeclareExchangeOnHost (System.String name, AmqpExchangeTypes type, Boolean durable, Boolean autoDelete, IDictionary`2 args) (at Assets/CymaticLabs/Amqp/Scripts/AmqpClient.cs:1393)
CymaticLabs.Unity3D.Amqp.AmqpClient.DeclareExchange (System.String name, AmqpExchangeTypes type, Boolean durable, Boolean autoDelete, IDictionary`2 args) (at Assets/CymaticLabs/Amqp/Scripts/AmqpClient.cs:1379)
ClientNode.PostConnect () (at Assets/Scripts/Messaging/ClientNode.cs:19)
BaseMessagingNode+<DeferredPostConnect>c__Iterator0.MoveNext () (at Assets/Scripts/Messaging/BaseMessagingNode.cs:93)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

AmqpClient.Instance.IsConnected is true at this point.

I get the same result whether I declare the exchange synchronously on the "FinishConnected" callback from GetExchangesAsync, or following it via a Unity coroutine that waits for a second or two afterward.

Any ideas?

Monoblanco4 commented 4 years ago

Were you able to figure it out? I am getting the same error in the same situation, AmqpClient.Instance.IsConnected is true for me as well the same point.

klydra commented 4 years ago

Were you able to figure it out? I am getting the same error in the same situation, AmqpClient.Instance.IsConnected is true for me as well the same point.

Same here...

EDIT: I couldn't find any solution to fix this error. Alternative library to use here : #16