Does ServiceStack.RabbitMq support creating Quorum queues? - c#

RabbitMQ allows for 'Quorum Queues'. As far as I have read in the documentation, 'quorum' queues allow queues to be replicated on all nodes within a rabbit cluster, whereas 'classic' queues host a specific queue on a specific node. I understand that there will be a higher latency when using 'quorum' over 'classic' queues.
I use ServiceStack to talk to RabbitMQ. The exchanges and the queues are created automatically - based around my requests and responses, and this all works well.
I am writing software for use in a highly available environment - I am writing C# code, using .NET 6 in a Linux environment (docker containers running in K8s), and am using ServiceStack 6.0.2. I would like to use 'quorum' queues rather than 'classic' queues if possible to help prevent message loss if one of the rabbit nodes in the cluster goes down.
Is it possible for ServiceStack to create 'quorum' queues? Having read through the documentation, searched SO, searched the ServiceStack forums, general web searching and experimentation in a stand-alone application, I can find no obvious way of creating these types of queues automatically via ServiceStack. By the looks of it, the queues are registered with various features, but always seem to be created as 'classic' queues.
Furthermore, will there be any problem with using ServiceStack and 'quorum' queues? The RabbitMQ documentation suggests that A client library that can use regular mirrored queues will be able to use quorum queues., but I am unclear if this is the case with ServiceStack.

No ServiceStack doesn't support creating Rabbit MQ Quorum Queues.
ServiceStack MQ is a messaging abstraction over multiple MQ implementations to enable alternative Reply and OneWay endpoints for invoking your Services.
You'll need to utilize the MQ libraries directly when you need additional MQ-specific features beyond this.

Related

Service Bus Local Dev

I'm aware a lot of people have asked about Azure Service Bus local development story and I'm familiar that Microsoft don't provide an on premise solution at the moment. I have also familiarised myself with Jimmy Bogart's writings on the matter.
I have a variation on the repeated question which I think hasn't been answered before. I have a legacy codebase that is using the older service bus API Microsoft.ServiceBus.Messaging.QueueClient which cannot be easily changed. I also am unable to stub the dependency.
Ideally I'd like to use something like RabbitMQ on-prem for local dev. I was thinking they both can use AMQP v1.0 protocol. Is it possible to force the Service Bus client to use RabbitMQ (or similar) as an AMQP endpoint with the Microsoft.ServiceBus.Messaging.QueueClient class just with changing the connection string - as a replacement for the ASB dependency? (all I need to support is deferal of messages)
Appreciate this use case is a little bizarre, but would appreciate any help/thoughts.
Thanks,
Chris.
I'm not aware of such an option. The best you could do is to use a messaging framework that acts as a broker abstraction (MassTransit, NServiceBus, etc) and swap out the connection string. And even with that approach is not going to be flawless because not all messaging brokers are born equal.
If you cannot introduce an abstraction, you'll need to plan a migration to Azure.Messaging.ServiceBus (latest SDK).

Create Pub/Sub service WITHOUT third parties tool

I would like to find a solution to create a pub/sub medium for 2 microservices to talk to each other,
I am aware i can use some third parties E.g Redis, RabbitMQ
Implementing event-based communication between microservices (integration events)
The challenge lies on the client is unable to allow install any third parties tool due to security reason.
The messageQueue server in Windows won't be allowed to use too.
I can only use the applications that is only existed in the server.
Therefore i am asking if there is anyway that i can create one simple app using windows service.
It is a one-to-many relationship. I have one service that will be dealing with data, once if there is any update, it will publish to those services that is subsribed to it.
It seems my problem could be similar with
.NET Scalable Pub/Sub service implementation
WCF Pub/Sub with subscriber caching(link is dead on the WCF pub-sub)
but i dont see any critical solutions.
I was thinking to use data notifications that MSSQL offers as last alternatives, but seems like it could cause a bottle neck when the applications get scale up.
The internet is so much flooded with articles using third parties tool.
Thanks
Check out Rebus library, that allows using different transport methods to send end receive messages in just a line of code (so in the future you can change it without effort).
You could use SQL Server or try to develop your own transport method

Easynetq: developer's queues

Lately we have setup easynetq queues in publish-subscribe and request-response way and common queue connection / endpoint. The goal is setup easynetq in way that developing logic using queue must be independent between developers - currently we have configured easynetq that every developer machine gets his own prefixed set of queues but it looks like that if 2 ot more developers starts subscribers they read messages from owned queues and also other developers queueus.
How configure easynetq using code to resolve this issue?
An easier way to isolate the activities of different developers, as you describe, would be to use a different virtual host (vhost in the connection string) for each developer. vhosts are completely isolated from each other.
Queues could then have the same name for each developer. The fact that they are on a different vhost would separate them.
https://www.rabbitmq.com/vhosts.html

How to implement message queuing and handling in AWS with NServiceBus

I am creating a new ASP MVC order application in the Amazon (AWS) cloud with the persistence layer at my local datacenter. I will be using the CQRS pattern. The goal of the project is high availability using Queue(s) to store and forward writes (commands/events) that can be picked up and handled asynchronously at my local datacenter. Then, ff the WAN or my local datacenter fails, my cloud MVC app can still take orders and just queue them up until processing can resume.
My first thought was to use AWS SQS for the queuing and create my own queue consumer/dispatcher/handler in my own c# application to process the incoming messages/events.
MVC (# Amazon) --> Event/POCO --> SQS --> QueueReader (# my datacenter) --> DB
Then I found NServiceBus. NSB seems to handle lots of details very nicely: message handling, retries, error handling, etc. I hate to reinvent the wheel, and NServiceBus seems like a full featured and mature product that would be perfect for me.
But on further research, it does NOT look like NServiceBus is really meant to be used over the WAN in physically separated environments (Cloud to my Datacenter). Google and SO don't really paint a good picture of using NServiceBus across the WAN like I need.
Can I do this?
MVC (# Amazon) --> Event/POCO --> NServiceBus over WAN --> NServiceBus Handler(s) --> DB
How can I use NServiceBus across the WAN? Or is there a better solution to handle queuing and message handling between Amazon an my local datacenter?
Using SQS as a transport for NServiceBus is an option, however you have to be aware of the trade offs as described here. This has been done with Azure queue storage, though I'm not aware of any great SQS implementations.
Another option is to create a VPN between your datacenter and an AWS VPC. This would allow direct MSMQ communication between AWS servers and your data center, provided you open the appropriate ports in the corresponding security group. There are some caveats with this approach. First, is regarding endpoint names. NServiceBus version 2.6 and below uses Environment.MachineName as the name of the endpoint, for which you would have to setup a proper DNS. I believe later versions use the machine's IP address. Perhaps a more important caveat is that a VPN makes your systems more coupled.
Yet another way, is to use the NServiceBus notion of a gateway. This however should be a logical business decision. A gateway is very similar to the regular transport but is usually has a different business context behind it.
NServiceBus includes a Gateway component that handles bridging physically separated data centers.
http://docs.particular.net/nservicebus/gateway/
It basically moves the messaging to an HTTP channel and handles the retry logic and deduplication issues that you'd normally have with a web service.
If you download the full NServiceBus package (not just include it via NuGet) then you will see a folder full of samples and one of those covers usage of the Gateway, and that is a great way to get started.

Writing a long-running pubsub server/service c#

I have been playing around with pubsub and so far it looks good for what I need (a basic game experiment).
From a Javascript perspective and mobile (via Appcelerator's Titanium) I can really see the value of using pubsub.
However, I need to write a server app in c#/.NET (although open to other ideas) to listen to the subscriber queue I have, and process the messages.. which involves some decision making etc, and then possibly writing another message to the publish queue for example.
So far I have played with RX (Reactive Extensions) for C# which listen on my subscribe channel. So far so good, I see the messages come in, although for now I just wrote a C# console app to test.
My question is would the best way to wait and listen for pubsub subscriber messages be to write a windows service app? or is there another technique more appropriate? obviously at some possible point I might have to scale the server to 2-3 servers, however given the nature of pubsub queue/messaging, I don't see a problem if I had some load-balancing etc.
Any ideas welcome!
Use Service Bus. When cloud is good for you, than Azure Service Bus. When not then nServiceBus. Take a look also for RabbitMQ, it's AMQP framework and is able to do more then pubsub. Also rabbit has multiple clients on multiple platorms. For example one of approaches purely for JavaScript is RabitMQ + Node.js + WebSockets.
All clients and devtools, and articles about RabbitMQ for different platforms and languages are here.
There is also special RabbitMQ binding for .NET, find it here.
NServiceBus PubSub explanation is here. It's .NET service bus, but is not such free as RabbitMQ. Anyway RabbitMQ is platform agnostic.
Any of service buses implementations already has PubSub, that is the reason they exist. Therefore there is no reason to implement, what is already implemented

Categories

Resources