private void SendConnectMessage() { if (NatsMessagingStatus.RUNNING != status) { throw new InvalidOperationException(); } var message = new Connect { Verbose = false, Pedantic = false, }; if (false == natsUser.IsNullOrWhiteSpace()) { message.User = natsUser; message.Password = natsPassword ?? String.Empty; } // TODO 201207 This should be part of message itself string msgstr = NatsCommand.FormatConnectMessage(message); log.Debug(Resources.NatsClient_PublishConnect_Fmt, msgstr); Write(msgstr); }
private void SendSubscription(INatsSubscription subscription) { log.Debug(Resources.NatsClient_SubscribingToSubject_Fmt, subscription, subscription.SubscriptionID); string formattedMessage = NatsCommand.FormatSubscribeMessage(subscription, subscription.SubscriptionID); log.Trace(Resources.NatsClient_LogSent_Fmt, formattedMessage); Write(formattedMessage); }
private void DoPublish(string subject, string json, uint delay = 0) { log.Debug(Resources.NatsClient_PublishMessage_Fmt, subject, delay, json); string formattedMessage = NatsCommand.FormatPublishMessage(subject, json); log.Trace(Resources.NatsClient_LogSent_Fmt, formattedMessage); if (delay == 0) { Write(formattedMessage); } else { var delayTimer = new MessageTimer(delay, formattedMessage); delayTimer.Elapsed += DelayedPublishElapsedHandler; delayTimer.Enabled = true; } }
public void Publish(NatsCommand command, INatsMessage message) { DoPublish(command.Command, message); }
public void Publish(NatsCommand command, INatsMessage message) { DoPublish(command.Command, message); }