本文整理汇总了C#中IConsumer类的典型用法代码示例。如果您正苦于以下问题:C# IConsumer类的具体用法?C# IConsumer怎么用?C# IConsumer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IConsumer类属于命名空间,在下文中一共展示了IConsumer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTokenAsync
public async Task<IToken> GetTokenAsync(IConsumer consumer, IUser user)
{
if (!HasStore)
return await GetTokenAsync(consumer);
var token = Store.Find(user.Name);
if (token == null)
{
token = await GetTokenAsync(consumer);
token.UserId = user.Name;
Store.Add(token);
return token;
}
if (!token.HasExpired)
return token;
var newToken = await RenewTokenAsync(token, consumer);
newToken.UserId = user.Name;
Store.Delete(token);
Store.Add(newToken);
return newToken;
}
示例2: OAuthRequestToken
public OAuthRequestToken(
string token,
string secret,
IConsumer consumer,
TokenStatus status,
OAuthParameters associatedParameters,
IIdentity authenticatedUser,
string[] roles)
: this()
{
if (string.IsNullOrEmpty(token))
throw new ArgumentException("token must not be null or empty", "token");
if (secret == null)
throw new ArgumentNullException("secret", "secret must not be null");
if (consumer == null)
throw new ArgumentNullException("consumer", "consumer must not be null");
if (roles == null)
throw new ArgumentNullException("roles", "roles must not be null");
this.Token = token;
this.Secret = secret;
this.Status = status;
this.ConsumerKey = consumer.Key;
this.AssociatedParameters = associatedParameters;
this.AuthenticatedUser = authenticatedUser;
this.Roles = roles;
}
示例3: BuildFailure
private static ConsumedMessage.ConsumingResult BuildFailure(IConsumer consumer,
ConsumedMessageBase message,
Exception exception)
{
consumer.OnError(exception);
return new ConsumedMessage.Failure(message, consumer, exception);
}
示例4: OAuthToken
/// <summary>
/// Create a simple token received from a service provider.
/// </summary>
/// <param name="type">Token type</param>
/// <param name="token">Token</param>
/// <param name="secret">Secret</param>
/// <param name="consumer">Consumer</param>
public OAuthToken(TokenType type, string token, string secret, IConsumer consumer)
{
this.Type = type;
this.Token = token;
this.Secret = secret;
this.ConsumerKey = consumer.Key;
}
示例5: OAuthAccessToken
public OAuthAccessToken(
string token,
string secret,
IConsumer consumer,
TokenStatus status,
IRequestToken requestToken)
: this()
{
if (string.IsNullOrEmpty(token))
throw new ArgumentException("token must not be null or empty", "token");
if (secret == null)
throw new ArgumentNullException("secret", "secret must not be null");
if (consumer == null)
throw new ArgumentNullException("consumer", "consumer must not be null");
if (requestToken == null)
throw new ArgumentNullException("requestToken", "requestToken must not be null");
this.Token = token;
this.Secret = secret;
this.Status = status;
this.ConsumerKey = consumer.Key;
this.RequestToken = requestToken;
}
示例6: GetToken
public IToken GetToken(IConsumer consumer, IUser user)
{
IToken token;
if (HasStore)
{
IToken sessionToken = Store.Find(user.Name);
if (sessionToken == null || sessionToken.HasExpired)
{
sessionToken = GetToken(consumer);
sessionToken.UserId = user.Name;
Store.Add(sessionToken);
}
token = sessionToken;
}
else
{
token = GetToken(consumer);
}
return token;
}
示例7: GetToken
public IToken GetToken(IConsumer consumer, IUser user)
{
if (!HasStore)
return GetToken(consumer);
var token = Store.Find(user.Name);
if (token == null)
{
token = GetToken(consumer);
token.UserId = user.Name;
Store.Add(token);
return token;
}
if (!token.HasExpired)
return token;
var newToken = RenewToken(token, consumer);
newToken.UserId = user.Name;
Store.Delete(token);
Store.Add(newToken);
return newToken;
}
示例8: PublicMvcAuthenticator
public PublicMvcAuthenticator(string baseUri, string tokenUri, string callBackUrl,
ITokenStore store, IConsumer consumer, ITokenStore requestTokenStore)
: base(baseUri, tokenUri, callBackUrl, store)
{
_consumer = consumer;
_requestTokenStore = requestTokenStore;
}
示例9: can_run_consumer
public void can_run_consumer()
{
var lst = ServiceLocator.Current.GetAllInstances<IConsumer>();
_consumer = lst.Find(
s => s.GetType() == typeof (Subscriber<OrderChangeRequestReceivedMessage>));
((Subscriber<OrderChangeRequestReceivedMessage>)_consumer).Consume(buildMsg());
}
示例10: SampleService
public SampleService(IConsumer messageCommandConsumer, IPublisher publisher, TopologyBootstrapper topologyBootstrapper)
{
_messageCommandConsumer = messageCommandConsumer;
_publisher = publisher;
_topologyBootstrapper = topologyBootstrapper;
_stopped = false;
}
示例11: GetRedirectUri
public string GetRedirectUri(IConsumer consumer)
{
var redirectUri = RedirectUri;
if (redirectUri != null)
{
var consumerDomain = consumer.Domain.ToLowerInvariant();
var match = Regexs.HTTPUrl.Match(redirectUri);
if (!match.Success)
throw new OAuthException(ErrorCode.InvalidRequest, "The redirect_uri parameter must be an absolute uri");
var domain = match.Groups["domain"].Value.ToLowerInvariant();
var subdomain = match.Groups["subdomain"].Value.ToLowerInvariant();
string redirectDomain;
if (domain.Count(x => x == '.') == 1)
redirectDomain = subdomain + domain;
else
redirectDomain = domain.Trim(new[] { '.' });
if (redirectDomain != consumerDomain)
throw new OAuthException(ErrorCode.InvalidRequest, "The redirect_uri is not authorized");
}
else
redirectUri = consumer.RedirectUrl;
return redirectUri;
}
示例12: Subscribe
public override bool Subscribe(IConsumer consumer, Hashtable parameterMap)
#endif
{
bool success = base.Subscribe(consumer, parameterMap);
if (success)
FireConsumerConnectionEvent(consumer, PipeConnectionEvent.CONSUMER_CONNECT_PULL, parameterMap);
return success;
}
示例13: RemoveConsumerFromQueue
protected override void RemoveConsumerFromQueue(IConsumer consumer)
{
var s = Dispatcher.GetSubscriber(consumer.Id);
if(s == null)
throw new Exception("Subscriber with Id=" + consumer.Id + " not found");
s.StopConsuming();
}
开发者ID:sportingsolutions,项目名称:SS.Integration.UnifiedDataAPIClient.DotNet,代码行数:8,代码来源:MockedStreamController.cs
示例14: StreamSubscriber
public StreamSubscriber(IModel model, IConsumer consumer, IDispatcher dispatcher)
: base(model)
{
Consumer = consumer;
ConsumerTag = consumer.Id;
Dispatcher = dispatcher;
_isDisposed = false;
}
开发者ID:sportingsolutions,项目名称:SS.Integration.UnifiedDataAPIClient.DotNet,代码行数:8,代码来源:StreamSubscriber.cs
示例15: PartnerMvcAuthenticator
public PartnerMvcAuthenticator(string baseUri, string authorizeUri, string callBackUri,
ITokenStore store, string signingCertificatePath, string certificatePath, string entrustPassword,
IConsumer consumer, ITokenStore requestTokenStore, string signingCertPassword)
: this(baseUri, authorizeUri, callBackUri, store, consumer, requestTokenStore)
{
_signingCertificate = new X509Certificate2(signingCertificatePath, signingCertPassword, X509KeyStorageFlags.MachineKeySet);
_certificate = new X509Certificate2(certificatePath, entrustPassword);
}