예제 #1
0
 private void PublishErrorIfNeeded(IWampPublisher publisher, long requestId, bool acknowledge, WampException ex)
 {
     if (acknowledge)
     {
         publisher.PublishError(requestId, ex);
     }
 }
예제 #2
0
 public void Publish(IWampPublisher publisher,
                     long requestId,
                     PublishOptions options,
                     string topicUri)
 {
     InnerPublish(publisher, topicUri, requestId, options, publishOptions => mRawTopicContainer.Publish(publishOptions, topicUri));
 }
예제 #3
0
 private void SendPublishAckIfNeeded(IWampPublisher publisher, long requestId, long publicationId, bool acknowledge)
 {
     if (acknowledge)
     {
         publisher.Published(requestId, publicationId);
     }
 }
예제 #4
0
 public void Publish(IWampPublisher publisher,
                     long requestId,
                     PublishOptions options,
                     string topicUri,
                     TMessage[] arguments,
                     IDictionary <string, TMessage> argumentKeywords)
 {
     InnerPublish(publisher, topicUri, requestId, options, publishOptions => mRawTopicContainer.Publish(publishOptions, topicUri, arguments, argumentKeywords));
 }
예제 #5
0
        public override void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri)
        {
            Action publishAction = () => base.Publish(publisher, requestId, options, topicUri);

            InnerPublish(publisher,
                         publishAction,
                         requestId,
                         options,
                         topicUri);
        }
예제 #6
0
        public override void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri, TMessage[] arguments,
                                     IDictionary <string, TMessage> argumentKeywords)
        {
            Action publishAction =
                () => base.Publish(publisher, requestId, options, topicUri, arguments, argumentKeywords);

            InnerPublish(publisher,
                         publishAction,
                         requestId,
                         options,
                         topicUri);
        }
예제 #7
0
 private void InnerPublish(IWampPublisher publisher, Action publishAction, long requestId, PublishOptions options, string topicUri)
 {
     InnerAction(publisher,
                 authorizer => authorizer.CanPublish(options, topicUri),
                 publishAction,
                 exception =>
     {
         if (options.Acknowledge == true)
         {
             publisher.PublishError(requestId, exception);
         }
     });
 }
예제 #8
0
        private PublishOptions GetPublishOptions(IWampPublisher publisher, string topicUri, PublishOptions options)
        {
            IWampClientProxy casted = publisher as IWampClientProxy;

            PublishOptionsExtended result = new PublishOptionsExtended(options);

            result.PublisherId = casted.Session;

            WelcomeDetails welcomeDetails = casted.WelcomeDetails;

            result.AuthenticationId   = welcomeDetails.AuthenticationId;
            result.AuthenticationRole = welcomeDetails.AuthenticationRole;

            result.TopicUri = topicUri;

            return(result);
        }
예제 #9
0
        private void InnerPublish(IWampPublisher publisher, string topicUri, long requestId, PublishOptions options,
                                  Func <PublishOptions, long> action)
        {
            PublishOptions publishOptions = GetPublishOptions(publisher, topicUri, options);

            bool acknowledge = publishOptions.Acknowledge ?? false;

            try
            {
                ValidatePublishUri(topicUri);

                long publicationId = action(publishOptions);

                SendPublishAckIfNeeded(publisher, requestId, publicationId, acknowledge);
            }
            catch (WampException ex)
            {
                mLogger.ErrorFormat(ex,
                                    "Failed publishing to topic '{0}'. Publication request id: {1}",
                                    topicUri, requestId);

                PublishErrorIfNeeded(publisher, requestId, acknowledge, ex);
            }
        }
예제 #10
0
 public void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri, TMessage[] arguments, IDictionary <string, TMessage> argumentKeywords)
 {
     throw new System.NotImplementedException();
 }
예제 #11
0
 public void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri)
 {
     throw new System.NotImplementedException();
 }
 public void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri, TMessage[] arguments)
 {
     throw new NotImplementedException();
 }
예제 #13
0
 public virtual void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri, TMessage[] arguments, IDictionary <string, TMessage> argumentKeywords)
 {
     mBroker.Publish(publisher, requestId, options, topicUri, arguments, argumentKeywords);
 }
예제 #14
0
 public virtual void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri)
 {
     mBroker.Publish(publisher, requestId, options, topicUri);
 }