I need to realize a simple cluster of workers that creates file zip file with a lot of pdf in it. The architecture, right now look like this:
- A single client (WebAPI + AngularJS)
- A cluster of Hangfire server that do the work
As soon the clients ask for a new zip file, the request is enqueued in the Hangfire queue. When one of the node in the cluster is free, the job will starts. During the execution of the job the client will be notified about the progress. Since the cluster, is necessary another component:
- A so called, SignalR backplane that handle the communication between workers and client
I use Redis to implement this component, and thanks to some NuGet packages (i.e. Microsoft.AspNet.SignalR
, Microsoft.AspNet.SignalR.Redis
) and this doc this is super simple and the only things I need is to add some new line in the Owin startups file; one for the worker:
public class WorkerStartup
{
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("HangFireDB");
GlobalHost.DependencyResolver.UseRedis("IP", 6379, String.Empty, "TOPIC");
app.MapSignalR();
app.UseHangfireServer();
}
}
one for the WebAPI, they are equals but Hangfire configuration:
public class ClientStartup
{
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("HangFireDB");
GlobalHost.DependencyResolver.UseRedis("IP", 6379, String.Empty, "TOPIC");
app.MapSignalR();
app.UseHangfireDashboard(); // The client only needs Hangfire dashboard
}
}
It works like a charm and Redis do the job pretty well. I would try to reimplement everything using Azure Service Bus (based on the link here), I replaced the package Microsoft.AspNet.SignalR.Redis
with Microsoft.AspNet.SignalR.ServiceBus
and replaced the line UseRedis
like:
GlobalHost.DependencyResolver.UseServiceBus("Endpoint=sb://XXX.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXX", "TOPIC");
but as soon I start the client/server communication I get:
No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization."
What's wrong, it should work without problem...