Exemplo n.º 1
0
 public MQConsumer(string instanceId, string topicName, string consumer, string messageTag, AliyunServiceClient serviceClient)
 {
     this._instanceId    = instanceId;
     this._topicName     = topicName;
     this._consumer      = consumer;
     this._messageTag    = messageTag;
     this._serviceClient = serviceClient;
 }
Exemplo n.º 2
0
 public MQTransProducer(string instanceId, string topicName, string groupId, AliyunServiceClient serviceClient) : base(instanceId, topicName, serviceClient)
 {
     if (string.IsNullOrEmpty(groupId))
     {
         throw new MQException("GroupId is null or empty!");
     }
     this._groupId = groupId;
 }
Exemplo n.º 3
0
 public MQConsumer(string instanceId, string topicName, string consumer, string messageTag, AliyunServiceClient serviceClient)
 {
     this._instanceId = instanceId;
     this._topicName  = topicName;
     this._consumer   = consumer;
     if (messageTag != null)
     {
         this._messageTag = AliyunSDKUtils.UrlEncode(messageTag, false);
     }
     this._serviceClient = serviceClient;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Instantiates Topic with the parameterized properties
        /// </summary>
        public Topic(string topicName, AliyunServiceClient serviceClient)
        {
            _topicName     = topicName;
            _serviceClient = serviceClient;

            Uri endpointUri = serviceClient.Config.RegionEndpoint;

            if (endpointUri != null)
            {
                string[] hostPieces = endpointUri.Host.Split('.');
                _accountId = hostPieces[0];
                _region    = hostPieces[2].Split(new[] { "-internal" }, StringSplitOptions.RemoveEmptyEntries)[0];
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates the HttpWebRequest and configures the end point, content, user agent and proxy settings.
        /// </summary>
        /// <param name="requestContext">The async request.</param>
        /// <returns>The web request that actually makes the call.</returns>
        protected virtual IHttpRequest <TRequestContent> CreateWebRequest(IRequestContext requestContext)
        {
            IRequest request     = requestContext.Request;
            Uri      url         = AliyunServiceClient.ComposeUrl(request);
            var      httpRequest = _requestFactory.CreateHttpRequest(url);

            httpRequest.ConfigureRequest(requestContext);

            httpRequest.Method = request.HttpMethod;
            if (request.MayContainRequestBody())
            {
                if (request.Content == null && (request.ContentStream == null))
                {
                    string queryString = AliyunSDKUtils.GetParametersAsString(request.Parameters);
                    request.Content = Encoding.UTF8.GetBytes(queryString);
                }

                if (request.Content != null)
                {
                    request.Headers[HttpHeader.ContentLengthHeader] =
                        request.Content.Length.ToString(CultureInfo.InvariantCulture);
                }
                else if (request.ContentStream != null && !request.Headers.ContainsKey(HttpHeader.ContentLengthHeader))
                {
                    request.Headers[HttpHeader.ContentLengthHeader] =
                        request.ContentStream.Length.ToString(CultureInfo.InvariantCulture);
                }
            }
            else if (request.UseQueryString &&
                     (request.HttpMethod == "POST" ||
                      request.HttpMethod == "PUT" ||
                      request.HttpMethod == "DELETE"))
            {
                request.Content = new Byte[0];
            }

            return(httpRequest);
        }
Exemplo n.º 6
0
 /// <inheritdoc/>
 public ListSubscriptionResponse EndListSubscription(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <ListSubscriptionResponse>(asyncResult));
 }
Exemplo n.º 7
0
 /// <inheritdoc/>
 public SetSubscriptionAttributeResponse EndSetSubscriptionAttribute(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <SetSubscriptionAttributeResponse>(asyncResult));
 }
Exemplo n.º 8
0
 /// <inheritdoc/>
 public UnsubscribeResponse EndUnsubscribe(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <UnsubscribeResponse>(asyncResult));
 }
Exemplo n.º 9
0
 /// <inheritdoc/>
 public SetTopicAttributesResponse EndSetAttributes(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <SetTopicAttributesResponse>(asyncResult));
 }
Exemplo n.º 10
0
 /// <inheritdoc/>
 public GetQueueAttributesResponse EndGetAttributes(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <GetQueueAttributesResponse>(asyncResult));
 }
Exemplo n.º 11
0
 /// <inheritdoc/>
 public BatchSendMessageResponse EndBatchSendMessage(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <BatchSendMessageResponse>(asyncResult));
 }
Exemplo n.º 12
0
 /// <inheritdoc/>
 public ReceiveMessageResponse EndReceiveMessage(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <ReceiveMessageResponse>(asyncResult));
 }
Exemplo n.º 13
0
 /// <inheritdoc/>
 public DeleteMessageResponse EndDeleteMessage(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <DeleteMessageResponse>(asyncResult));
 }
Exemplo n.º 14
0
 /// <inheritdoc/>
 public ChangeMessageVisibilityResponse EndChangeMessageVisibility(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <ChangeMessageVisibilityResponse>(asyncResult));
 }
Exemplo n.º 15
0
 /// <inheritdoc/>
 public PublishMessageResponse EndPublishMessage(IAsyncResult asyncResult)
 {
     return(AliyunServiceClient.EndInvoke <PublishMessageResponse>(asyncResult));
 }
Exemplo n.º 16
0
 /// <summary>
 /// Instantiates Queue with the parameterized properties
 /// </summary>
 public Queue(string queueName, AliyunServiceClient serviceClient)
 {
     _queueName     = queueName;
     _serviceClient = serviceClient;
 }
Exemplo n.º 17
0
 public MQProducer(string instanceId, string topicName, AliyunServiceClient serviceClient)
 {
     this._instanceId    = instanceId;
     this._topicName     = topicName;
     this._serviceClient = serviceClient;
 }