Ejemplo n.º 1
0
 private void PublishErrorIfNeeded(IWampPublisher publisher, long requestId, bool acknowledge, WampException ex)
 {
     if (acknowledge)
     {
         publisher.PublishError(requestId, ex);
     }
 }
Ejemplo n.º 2
0
 public void Publish(IWampPublisher publisher,
                     long requestId,
                     PublishOptions options,
                     string topicUri)
 {
     InnerPublish(publisher, topicUri, requestId, options, publishOptions => mRawTopicContainer.Publish(publishOptions, topicUri));
 }
Ejemplo n.º 3
0
 private void SendPublishAckIfNeeded(IWampPublisher publisher, long requestId, long publicationId, bool acknowledge)
 {
     if (acknowledge)
     {
         publisher.Published(requestId, publicationId);
     }
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
         }
     });
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 10
0
 public void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri, TMessage[] arguments, IDictionary <string, TMessage> argumentKeywords)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 14
0
 public virtual void Publish(IWampPublisher publisher, long requestId, PublishOptions options, string topicUri)
 {
     mBroker.Publish(publisher, requestId, options, topicUri);
 }