Esempio n. 1
0
 private void DoPublish(string subject, INatsMessage message, uint delay = 0)
 {
     // TODO 201207 if (Message.RECEIVE_ONLY == subject)
     if (message.IsReceiveOnly)
     {
         throw new InvalidOperationException(Resources.NatsClient_PublishReceiveOnlyMessage);
     }
     DoPublish(subject, message.ToJson(), delay);
 }
Esempio n. 2
0
 public void Publish(string subject, INatsMessage message)
 {
     if (message.CanPublishWithSubject(subject))
     {
         DoPublish(subject, message);
     }
     else
     {
         throw new InvalidOperationException(String.Format(Resources.NatsClient_InvalidPublishAttempt_Fmt, message.GetType().Name, subject));
     }
 }
Esempio n. 3
0
 public void PublishReply(string replyTo, INatsMessage message, uint delay)
 {
     if (message.CanPublishWithSubject(replyTo))
     {
         DoPublish(replyTo, message, delay);
     }
     else
     {
         throw new InvalidOperationException(String.Format(Resources.NatsClient_InvalidPublishAttempt_Fmt, message.GetType().Name, replyTo));
     }
 }
Esempio n. 4
0
        public static string FormatConnectMessage(INatsMessage message)
        {
            string messageJson = message.ToJson();

            return(String.Format(CultureInfo.InvariantCulture, NatsCommandFormats.ConnectFmt, message));
        }
Esempio n. 5
0
        public static string FormatPublishMessage(string subject, INatsMessage message)
        {
            string messageJson = message.ToJson();

            return(FormatPublishMessage(subject, messageJson));
        }
Esempio n. 6
0
 public static string FormatPublishMessage(string subject, INatsMessage message)
 {
     string messageJson = message.ToJson();
     return FormatPublishMessage(subject, messageJson);
 }
Esempio n. 7
0
 public static string FormatConnectMessage(INatsMessage message)
 {
     string messageJson = message.ToJson();
     return String.Format(CultureInfo.InvariantCulture, NatsCommandFormats.ConnectFmt, message);
 }
Esempio n. 8
0
 public void Publish(NatsCommand command, INatsMessage message)
 {
     DoPublish(command.Command, message);
 }
Esempio n. 9
0
 public void Publish(INatsMessage message)
 {
     DoPublish(message.PublishSubject, message);
 }
Esempio n. 10
0
 private void DoPublish(string subject, INatsMessage message, uint delay = 0)
 {
     // TODO 201207 if (Message.RECEIVE_ONLY == subject)
     if (message.IsReceiveOnly)
     {
         throw new InvalidOperationException(Resources.NatsClient_PublishReceiveOnlyMessage);
     }
     DoPublish(subject, message.ToJson(), delay);
 }
Esempio n. 11
0
 public void PublishReply(string replyTo, INatsMessage message, uint delay)
 {
     if (message.CanPublishWithSubject(replyTo))
     {
         DoPublish(replyTo, message, delay);
     }
     else
     {
         throw new InvalidOperationException(String.Format(Resources.NatsClient_InvalidPublishAttempt_Fmt, message.GetType().Name, replyTo));
     }
 }
Esempio n. 12
0
 public void Publish(NatsCommand command, INatsMessage message)
 {
     DoPublish(command.Command, message);
 }
Esempio n. 13
0
 public void Publish(INatsMessage message)
 {
     DoPublish(message.PublishSubject, message);
 }
Esempio n. 14
0
 public void Publish(string subject, INatsMessage message)
 {
     if (message.CanPublishWithSubject(subject))
     {
         DoPublish(subject, message);
     }
     else
     {
         throw new InvalidOperationException(String.Format(Resources.NatsClient_InvalidPublishAttempt_Fmt, message.GetType().Name, subject));
     }
 }