Sending requests before starting the end point

Is it possible to send requests before starting to process the normal queue?

Our micro services typically need to fetch and cache information from other services upon start before they successfully can process their own messages. The cache is normally persisted, but full disks, bad writes, new install etc will require one or more Request<TResult>() before message processing.

How are you hosting your endpoints?

We use windows services.

If hosting through the Host your easiest option is to place your code in the IConfigureThisEndpoint implementation. If your self-hosting, e.g. by using our templates (dotnet new Templates • Particular Docs), then you have full control over the startup sequence.

More options here Startup and Shutdown Sequence • NServiceBus Samples • Particular Docs

Just create 2 endpoints, 1 that controls the host and is responsible to aggregate data and then the actual endpoint that be initialized by the host with that data. Then each has its own queue and can be managed independently.

Second solution, don’t use an in-memory cache. Can you indicate why this is needed?

FeatureStartupTasks are run before the message pump starts consuming messages from the queue. You can send messages from FeatureStartupTasks as they receive an IMessageSession. Those tasks are started in sequence which means that a StartupTask can delay the endpoint startup process if it takes too long.