daishisystems / daishi.amqp Goto Github PK
View Code? Open in Web Editor NEWMicroservices SDK for .NET applications
Home Page: http://insidethecpu.com/2015/05/22/microservices-with-c-and-rabbitmq/
License: MIT License
Microservices SDK for .NET applications
Home Page: http://insidethecpu.com/2015/05/22/microservices-with-c-and-rabbitmq/
License: MIT License
When a client send a message to a microservice, the client needs to identity a queue to be used for the return message.
The clients gets a "unused" queue from QueuePool.Instance.Get();
But the fact that it is unused is determined by the client keeping track of which return queues are used.
If the previous user of the queue never fetched its message from this queue, the queue might still have a message in it.
I solved this problem by purging the queue everytime I get an "unused" queue from QueuePool.Instance.Get() by doing a channel.QueuePurge(queue.Name)
Since the assumption is that when a client gets a new return queue from QueuePool.Instance.Get(), that it would be "ready for use", and empty, would it be possible to make this a default behavior (first purging any potential messages from it) inside QueuePool.Instance.Get() before returning the queue to the client?
After upgrading to 4.1.1 I get the following error. If I downgrade it all works fine again. If you need any more info please don't hesitate
ERROR - Error creating the service bus System.MissingFieldException: Field not found: 'RabbitMQ.Client.ConnectionFactory.HostName'.
at Daishi.AMQP.RabbitMQAdapter.Connect()
<snip....>
_adapter = RabbitMQAdapter.Instance;
_adapter.Init("localhost", 5672, "guest", "guest", 50);
_rabbitMqConsumerCatchAll = new RabbitMQConsumerCatchAll(GlobalResources.Properties.Resources.SurveyorMessageQueueText, 10);
_rabbitMqConsumerCatchAll.MessageReceived += OnMessageReceived;
_adapter.Connect();
_adapter.ConsumeAsync(_rabbitMqConsumerCatchAll);
In the AMQP's QueuePool.cs there is a hardcoded username and password:
Line 30: var manager = new RabbitMQQueueMetricsManager(false, "localhost", 15672, "paul", "password");
Can we rather read these values from a .config file (e.g. appSettings) ?
Specifically the Servername, Port, Username and Password parameters.
Context: the AMQP project, the QueuePool.cs file
Since each MicroService client keeps track of which return queues (GUID named) are used in its own ConcurrentBag, it is inevitable that other clients will also enumerate all GUID named queues and also see them as unused return queues - but blissfully unaware that another client might have started to use a queue.
I suggest that each client has its own pool of return queues - maybe by prefixing each GUID named queue with the client's unique name? In my scenario this should work because I will only have around 10-20 clients (other microservices), each with a unique name - but I'd like to hear other suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.