本文整理汇总了C#中ITransport类的典型用法代码示例。如果您正苦于以下问题:C# ITransport类的具体用法?C# ITransport怎么用?C# ITransport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITransport类属于命名空间,在下文中一共展示了ITransport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElasticClientFactory
public ElasticClientFactory(
IConnectionSettingsValues settings = null,
IConnection connection = null,
ITransport transport = null,
INestSerializer serializer = null) {
this.CreateClient(settings, connection, transport, serializer);
}
示例2: BusClient
public BusClient(ITransport transport, ISubscriptionKeyResolver keyResolver, IConfigurationContext configurationContext)
{
this.transport = transport;
this.keyResolver = keyResolver;
this.transport.InitializeForPublishing();
this.configurationContext = configurationContext;
}
示例3: TransportAsyncWorker
// For send/receive
private TransportAsyncWorker(ITransport transport, OperationType operation, byte[] buffer, int offset, int size, AsyncCallback callback, object state)
: this(transport, operation, callback, state)
{
_buffer = buffer;
_offset = offset;
_size = size;
}
示例4: Test
public static void Test(ITransport t, IQueueStrategy strategy,
Endpoint queueEndpoint, Action<Message> send, Func<MessageEnumerator>
enumer)
{
Guid id = Guid.NewGuid();
var serializer = new XmlMessageSerializer(new
DefaultReflection(), new DefaultKernel());
var subscriptionStorage = new MsmqSubscriptionStorage(new
DefaultReflection(),
serializer,
queueEndpoint.Uri,
new
EndpointRouter(),
strategy);
subscriptionStorage.Initialize();
var wait = new ManualResetEvent(false);
subscriptionStorage.SubscriptionChanged += () => wait.Set();
t.AdministrativeMessageArrived +=
subscriptionStorage.HandleAdministrativeMessage;
Message msg = new MessageBuilder
(serializer).GenerateMsmqMessageFromMessageBatch(new
AddInstanceSubscription
{
Endpoint = queueEndpoint.Uri.ToString(),
InstanceSubscriptionKey = id,
Type = typeof (TestMessage2).FullName,
});
send(msg);
wait.WaitOne();
msg = new MessageBuilder
(serializer).GenerateMsmqMessageFromMessageBatch(new
RemoveInstanceSubscription
{
Endpoint = queueEndpoint.Uri.ToString(),
InstanceSubscriptionKey = id,
Type = typeof (TestMessage2).FullName,
});
wait.Reset();
send(msg);
wait.WaitOne();
IEnumerable<Uri> uris = subscriptionStorage
.GetSubscriptionsFor(typeof (TestMessage2));
Assert.Equal(0, uris.Count());
int count = 0;
MessageEnumerator copy = enumer();
while (copy.MoveNext()) count++;
Assert.Equal(0, count);
}
示例5: ExecuteOperation
public Dictionary<string, string> ExecuteOperation(ITransport transport)
{
//Defines a new Dictonary which is capable of storing indexed string values with a string index.
Dictionary<string, string> result;
//Writes the request header
HeaderParams param = WriteHeader(transport, STATS_REQUEST);
transport.Flush();
ReadHeaderAndValidate(transport, param);
//reads the number of statistic details sent from server
int numberOfStats = transport.ReadVInt();
if (logger.IsTraceEnabled)
logger.Trace("Number of Stats : " + numberOfStats);
result = new Dictionary<string, string>();
//reads all statistics and add them to the 'result' dictionary
for (int i = 0; i < numberOfStats; i++)
{
String statName = transport.ReadString();
if (logger.IsTraceEnabled)
logger.Trace("Stat Name Recieved : " + statName);
String statValue = transport.ReadString();
if (logger.IsTraceEnabled)
logger.Trace("Stat ValueRecieved : " + statName);
result.Add(statName, statValue);
}
return result;
}
示例6: ThreadPoolWorkerFactory
/// <summary>
/// Creates the worker factory
/// </summary>
public ThreadPoolWorkerFactory(ITransport transport, IRebusLoggerFactory rebusLoggerFactory, IPipeline pipeline, IPipelineInvoker pipelineInvoker, Options options, Func<RebusBus> busGetter, BusLifetimeEvents busLifetimeEvents, ISyncBackoffStrategy backoffStrategy)
{
if (transport == null) throw new ArgumentNullException(nameof(transport));
if (rebusLoggerFactory == null) throw new ArgumentNullException(nameof(rebusLoggerFactory));
if (pipeline == null) throw new ArgumentNullException(nameof(pipeline));
if (pipelineInvoker == null) throw new ArgumentNullException(nameof(pipelineInvoker));
if (options == null) throw new ArgumentNullException(nameof(options));
if (busGetter == null) throw new ArgumentNullException(nameof(busGetter));
if (busLifetimeEvents == null) throw new ArgumentNullException(nameof(busLifetimeEvents));
if (backoffStrategy == null) throw new ArgumentNullException(nameof(backoffStrategy));
_transport = transport;
_rebusLoggerFactory = rebusLoggerFactory;
_pipeline = pipeline;
_pipelineInvoker = pipelineInvoker;
_options = options;
_busGetter = busGetter;
_backoffStrategy = backoffStrategy;
_parallelOperationsManager = new ParallelOperationsManager(options.MaxParallelism);
_log = _rebusLoggerFactory.GetCurrentClassLogger();
if (_options.MaxParallelism < 1)
{
throw new ArgumentException($"Max parallelism is {_options.MaxParallelism} which is an invalid value");
}
if (options.WorkerShutdownTimeout < TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException($"Cannot use '{options.WorkerShutdownTimeout}' as worker shutdown timeout as it");
}
busLifetimeEvents.WorkersStopped += WaitForContinuationsToFinish;
}
示例7: CachedTransport
public CachedTransport(string email, ITransport innerTranport)
{
userCacheService = new CacheService(email);
commonCacheService = new CacheService();
this.innerTranport = innerTranport;
this.innerTranport.Throttled += instance_Throttled;
}
示例8: DockingViewManager
public DockingViewManager(ITransport transport, IAdapter adapter, IScheduler scheduler, LocalScheduler dispatcher)
{
_transport = transport;
_adapter = adapter;
_scheduler = scheduler;
_dispatcher = dispatcher;
}
示例9: AbstractInterceptor
protected AbstractInterceptor(ITransport transport, IKernel kernel, ISerializer serializer, TimeoutManager timeoutManager)
{
m_transport = transport;
m_kernel = kernel;
m_serializer = serializer;
m_timeoutManager = timeoutManager;
}
示例10: GetWrapper
public static IAsyncTransport GetWrapper(ITransport transport)
{
// determine whether transport supports async operations and construct wrapper if not
return transport is IAsyncTransport
? (IAsyncTransport)transport
: new TransportAsyncWrapper(transport);
}
示例11: OnInterrupted
protected virtual void OnInterrupted(ITransport sender)
{
if(this.interruptedHandler != null)
{
this.interruptedHandler(sender);
}
}
示例12: Init
public void Init()
{
endpointTransport = Configure.Instance.Builder.Build<ITransport>();
endpointTransport.FinishedMessageProcessing += (x, y) => SendReadyMessage(false);
var bus = Configure.Instance.Builder.Build<IStartableBus>();
bus.Started += (x, y) =>
{
SendReadyMessage(true);
controlTransport.Start(ControlQueue);
};
endpointBus = Configure.Instance.Builder.Build<IBus>();
controlTransport = new TransactionalTransport
{
IsTransactional = true,
FailureManager = Configure.Instance.Builder.Build<IManageMessageFailures>(),
MessageReceiver = new MsmqMessageReceiver(),
MaxRetries = 1,
NumberOfWorkerThreads = NumberOfWorkerThreads
};
var serializer = Configure.Instance.Builder.Build<IMessageSerializer>();
controlTransport.TransportMessageReceived +=
(obj, ev) =>
{
var messages = serializer.Deserialize(new MemoryStream(ev.Message.Body));
foreach (var msg in messages)
if (msg is ReadyMessage)
Handle(msg as ReadyMessage, ev.Message.ReturnAddress);
};
}
示例13: OnResumed
protected virtual void OnResumed(ITransport sender)
{
if(this.resumedHandler != null)
{
this.resumedHandler(sender);
}
}
示例14: DurationTraderViewModelController
public DurationTraderViewModelController(ITransport transport, IAdapter adapter, IScheduler scheduler, LocalScheduler dispatcher)
{
transport.GetTradingObservables()
.SubscribeOn(scheduler)
.ObserveOn(dispatcher)
.Subscribe(fSet => adapter.updater(fSet, ViewModel));
}
示例15: TransportWrapper
public TransportWrapper(ITransport transport)
{
if (transport == null)
throw new ArgumentNullException("transport");
_transport = transport;
_serviceManager = new ServiceManager<TransportWrapper>("SendGrid Service", "Email Services");
}