MassTransit Check if queue and exchange exist - .net-core

I'm using dotnet with masstransit rabbitmq.
I was wondering if there's a way to check if a specific exchange and queue exist. I have 2 services that connect to the same rabbitmq and are started at the same time. One services does all of the queue/exchange setup; I want the 2nd service to do while loop check to see if the queue/exchange exist before proceeding.
I was trying to look at the documentation to see if I could find some examples, but could not locate any. Could someone point me in the right direction?
Thanks.

MassTransit does not generally support this type of coupling behavior, since it ends up linking the consuming service to the producing service. There are plenty of other solutions in MassTransit to support your needs, such as sending messages directly to a queue using queue:name as the destination address.
As such, there aren't any built-in methods to check queue/exchange existence in MassTransit.

Related

BizTalk 2016 Singleton

We have a flow that processes incoming bank statements from an external system to SAP. The process itself is rather simple
Receive bank statement via SFTP
Send to SAP via FTP
Call SAP RFC with filename as parameter
This all happens in an orchestration and on BizTalk side it's working fine.
Now, they have noticed that SAP has some issues when too many bank statements arrive at the same time. So we need to redesign the orchestration so it handles them 1-by-1.
So, my first thought was to redesign it as a Singleton orchestration to solve this issue. Does anybody have some other suggestions to fix this issue?
The messages don't need to be processed in a specific order. Just slower. :-)
I'm just a bit afraid of the possible sideffects of a Singleton.
You could consider putting the port on a dedicated host and configure resource based throttling.
If that doesn't suit, consider a Resource Dispenser pattern which is described here:
https://social.technet.microsoft.com/wiki/contents/articles/23924.biztalk-server-resource-dispenser-send-port-edition.aspx
Basically, messages are queued for a limited number of receiving service instances, and the destination send ports are set to ordered delivery, so each will have only on active instance.

NServiceBus IP Address

I am new to Nservicebus and have recently started working in it. I am stuck on a point and need input from you guys. I have 2 asp.net core web api projects and I want to use NServicebus to send messages between both of them in some scenarios.
What I have found so far that I can provide name to EndpointConfiguration, what if one of my api is deployed on 1 server and 2nd on another server, in that case how my configuration should be?
I tried to gave url instead of name in EndpointConfiguration but it gave me exception.
Thanks in advance for your help
NServiceBus endpoints communicate over some messaging infrastructure your system will be using. Endpoint names represent queues messages sent to. Messaging infrastructure is abstracted by what NServiceBus is calling a Transport. You will need to decide on the transport you'd like to use (see the options here). Once you've decided what transport your solution will use, you could have a look at the samples for that specific transports to have an idea how to set up your endpoints.
For example, if you'll decide to use Azure Service Bus as your transport, you could download and try the Send/Reply sample.
A good starting point could be the tutorials available on the documentation site here.

How to access Rebus from other languages?

How to integrate other languages than those from .net world? For example to access messages from the bus in Java or C++? Do I have to listen to the queue in the backend instead? Is there a common Api provided by Rebus?
While Rebus may market itself as a "service bus"(*), it is actually more a kind of a "driver" with a common abstraction that enables .NET programmers to use various queues and persistence technologies without worrying too much about the specifics.
As such, Rebus cannot really be connected to, much as you would not be able to connect to, say, the NpgsqlConnection or the SqlConnection you would use to communicate with your Postgres or SQL Server database.
What you could do, was to interface with Rebus at the transport and/or persistence level, e.g. by using the same wire-level format when exchanging messages.
This would require that the chosen transport (MSMQ, RabbitMQ, SQL Server, etc.) can be interfaced with from the desired platform, and then you would need to be able to supply the correct headers for Rebus to accept the message as valid.
There is no official Rebus implementation for any other platforms besides .NET (.NET 4.5 + .NET Standard 1.3).
To my knowledge, no one has attempted to actually build a Rebus-compatible messaging library on any other platform.
(*) I actually usually use the word "messaging library" to describe it, because I think it carries way less confusion and semantic overload with it.
Yes. I think we need to know a minimal message format that an application for example PHP can compose and send directly to an endpoint queue. That would make life easy in certain cases.

How Hystrix communicate with Eureka?

I've seen a lot examples of projects, where both Hystrix and Eureka are used.
It would be nice if someone could explain to me how they both communicate.
Maybe It's a wrong build question, but I would like to know why there is both hystrix and eureka on the projects.
Eureka and Hystrix are two different services, both developed by Netflix.
Eureka provides some kind of elastic load balancer. It has a server part (where the clients get registered), and a client one. The clients register themselves in the server by sending heartbeats, and also get the registry information from the server in order to know where the services (other clients) it needs are located (as a client can also be a service). Have a look at the eureka wiki for a much better explanation.
Hystrix is on the other hand an implementation of the Circuit Breaker Pattern (if you do not know what this is, buy the Release It book right now). It basically provides a way of controlling your "expensive" calls (normally to a remote system) by wrapping them. If the remote system is not available, or the calls are taking too long, Hystrix will deliver you a "failure" (or configured fallback) response immediately instead of keeping you blocked waiting for a response that will not come. The hystrix page explains it much better.

What are some various SOA approaches or methodologies

I've read of an ESB being used as a SOA approach. What are some other approaches?
This is a very broad question, you may want to focus is.
If you are asking regarding approaches that are instead of ESB, then you may consider using direct access to services, instead of using a service bus.
This approach is often used with a directory or lookup service like UDDI to look up service end point location.
When using an ESB, you send the message to the ESB, who 's responsible to route it to the service provider.
When using direct access the client should know in advance the address of the service provider, and he sends the message directly to him.
When using a lookup service, you first query the address of the service provider (like using DNS to lookup IP addresses), and using this address you send the message to the service provider.
Beyond addressing and routing, the ESB may provide other functions that you loose (or have to implement in other way) if you use the direct access approach.
multi cast routing - sending the request to more then one service provider
context based routing - deciding to which service provider we should send the request, based on the content of the request
central logging
central policy enforcement
load balancing \ fault tolerance
format or protocol translation
buffering and asynchronous service invocation
First.... ask yourself which SOA philosophy are you adhering to. If you are in the IBM camp, then there are 4 different products that provide ESB functionality. Each product is optimized for a different scenarios but basically each one does similar functions.
Think.... SOA == a car. IBM is one manufacturer. Different products == different type of cars for different type of drivers.

Resources