NServiceBus.ReadyMessageSender.SendReadyMessage C# (CSharp) Method

SendReadyMessage() private method

private SendReadyMessage ( int capacity, bool isStarting, TransportTransaction transaction ) : Task
capacity int
isStarting bool
transaction TransportTransaction
return Task
        Task SendReadyMessage(int capacity, bool isStarting, TransportTransaction transaction)
        {
            //we use the actual address to make sure that the worker inside the master node will check in correctly
            var readyMessage = ControlMessageFactory.Create(MessageIntentEnum.Send);

            readyMessage.Headers.Add(LegacyDistributorHeaders.WorkerCapacityAvailable, capacity.ToString());
            readyMessage.Headers.Add(LegacyDistributorHeaders.WorkerSessionId, workerSessionId);
            readyMessage.Headers.Add(Headers.ReplyToAddress, receiveAddress);

            if (isStarting)
            {
                readyMessage.Headers.Add(LegacyDistributorHeaders.WorkerStarting, bool.TrueString);
            }

            var transportOperation = new TransportOperation(readyMessage, new UnicastAddressTag(distributorControlAddress));
            return dispatcher.Dispatch(new TransportOperations(transportOperation), transaction, new ContextBag());
        }