本文整理汇总了C#中IMessageSerializer类的典型用法代码示例。如果您正苦于以下问题:C# IMessageSerializer类的具体用法?C# IMessageSerializer怎么用?C# IMessageSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMessageSerializer类属于命名空间,在下文中一共展示了IMessageSerializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AbstractMsmqListener
protected AbstractMsmqListener(
IQueueStrategy queueStrategy,
Uri endpoint,
int threadCount,
IMessageSerializer messageSerializer,
IEndpointRouter endpointRouter,
TransactionalOptions transactional,
IMessageBuilder<Message> messageBuilder)
{
this.queueStrategy = queueStrategy;
this.messageSerializer = messageSerializer;
this.endpointRouter = endpointRouter;
this.endpoint = endpoint;
this.threadCount = threadCount;
threads = new Thread[threadCount];
switch (transactional)
{
case TransactionalOptions.Transactional:
this.transactional = true;
break;
case TransactionalOptions.NonTransactional:
this.transactional = false;
break;
case TransactionalOptions.FigureItOut:
this.transactional = null;
break;
default:
throw new ArgumentOutOfRangeException("transactional");
}
this.messageBuilder = messageBuilder;
this.messageBuilder.Initialize(Endpoint);
}
示例2: MessageLoggingTests
public MessageLoggingTests()
{
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log_endpoint.esent");
if (Directory.Exists(path))
Directory.Delete(path, true);
container = new WindsorContainer();
new RhinoServiceBusConfiguration()
.UseCastleWindsor(container)
.UseStandaloneConfigurationFile("RhinoQueues/RhinoQueues.config")
.Configure();
container.Register(Component.For<MessageLoggingModule>());
messageSerializer = container.Resolve<IMessageSerializer>();
queue = new QueueManager(new IPEndPoint(IPAddress.Any, 2202), path);
queue.CreateQueues("log_endpoint");
queue.Start();
var innerTransport = container.Resolve<ITransport>();
innerTransport.Start();
transport = MockRepository.GenerateStub<ITransport>();
transport.Stub(t => t.Send(null, null)).IgnoreArguments()
.Do((Delegates.Action<Endpoint, object[]>)(innerTransport.Send));
}
示例3: ActiveMqMessageMapper
public ActiveMqMessageMapper(IMessageSerializer serializer, IMessageTypeInterpreter messageTypeInterpreter, IActiveMqMessageEncoderPipeline encoderPipeline, IActiveMqMessageDecoderPipeline decoderPipeline)
{
this.serializer = serializer;
this.messageTypeInterpreter = messageTypeInterpreter;
this.encoderPipeline = encoderPipeline;
this.decoderPipeline = decoderPipeline;
}
示例4: MicroMessageDecoder
/// <summary>
/// Initializes a new instance of the <see cref="MicroMessageDecoder" /> class.
/// </summary>
/// <param name="serializer">The serializer used to decode the message that is being transported with MicroMsg.</param>
/// <exception cref="System.ArgumentNullException">serializer</exception>
public MicroMessageDecoder(IMessageSerializer serializer)
{
if (serializer == null) throw new ArgumentNullException("serializer");
_serializer = serializer;
_bytesLeftForCurrentState = sizeof(short);
_stateMethod = ReadHeaderLength;
}
示例5: AsyncProcessingNetChannel
public AsyncProcessingNetChannel(Func<IMessageProcessingPipeBuilder, IMessageProcessingPipeBuilder> configureProcesssingPipe, INetNode node,
ITransportChannel transportChannel, IMessageSerializer serializer, ICoreEvents logger, INetNodeConfig config, IBufferPool bufferPool)
: base(node, transportChannel, serializer, logger, config, bufferPool)
{
_pipeBuilder = configureProcesssingPipe(new MessageProcessingPipeBuilder());
_processor = _pipeBuilder.Build();
}
示例6: RhinoFilesTransport
public RhinoFilesTransport(Uri endpoint,
IEndpointRouter endpointRouter,
IMessageSerializer messageSerializer,
int threadCount,
string path,
IsolationLevel queueIsolationLevel,
int numberOfRetries,
bool enablePerformanceCounters,
IMessageBuilder<MessagePayload> messageBuilder,
QueueManagerConfiguration queueManagerConfiguration)
{
_endpoint = endpoint;
_queueIsolationLevel = queueIsolationLevel;
_numberOfRetries = numberOfRetries;
_enablePerformanceCounters = enablePerformanceCounters;
_messageBuilder = messageBuilder;
_queueManagerConfiguration = queueManagerConfiguration;
_endpointRouter = endpointRouter;
_messageSerializer = messageSerializer;
_threadCount = threadCount;
_path = path;
_queueName = endpoint.GetQueueName();
_threads = new Thread[threadCount];
// This has to be the first subscriber to the transport events in order to successfully handle the errors semantics
new ErrorAction(numberOfRetries).Init(this);
messageBuilder.Initialize(Endpoint);
}
示例7: CreatePropertiesFactory
private Func<RogerEndpoint, IBasicProperties> CreatePropertiesFactory(IModel model,
IIdGenerator idGenerator,
IMessageTypeResolver messageTypeResolver,
IMessageSerializer serializer,
ISequenceGenerator sequenceGenerator)
{
var properties = model.CreateBasicProperties();
properties.MessageId = idGenerator.Next();
properties.Type = messageTypeResolver.Unresolve(messageType);
properties.ContentType = serializer.ContentType;
properties.Headers = new Hashtable
{
{Headers.Sequence, BitConverter.GetBytes(sequenceGenerator.Next(messageType))}
};
if (persistent)
properties.DeliveryMode = 2;
FillAdditionalProperties(properties, idGenerator);
return endpoint =>
{
properties.ReplyTo = endpoint;
return properties;
};
}
示例8: DefaultAsyncEventPublisher
public DefaultAsyncEventPublisher(ISubscriptionStore subscriptionStore, IMessageTransport messageTransport, IMessageSerializer messageSerializer, ILoggerFactory loggerFactory)
{
_subscriptionStore = subscriptionStore;
_messageTransport = messageTransport;
_messageSerializer = messageSerializer;
_logger = loggerFactory.Create("EventSourcing.DefaultAsyncEventPublisher");
}
示例9: CLogMessage
public CLogMessage(
IMessageSerializer messageSerializer,
DateTime timeStamp,
LogMessageCategoryEnum messageCategory,
bool isException,
bool isRootMessage,
string source,
string message,
string messageStackTrace,
string exceptionStackTrace,
ILogMessage childMessage
)
{
if (messageSerializer == null)
{
throw new ArgumentNullException("messageSerializer");
}
//childMessage allowed to be null
_messageSerializer = messageSerializer;
_timeStamp = timeStamp;
_messageCategory = messageCategory;
_isException = isException;
_isRootMessage = isRootMessage;
_source = source;
_message = message.CrLnNormalize();
_messageStackTrace = messageStackTrace.CrLnNormalize();
_exceptionStackTrace = exceptionStackTrace.CrLnNormalize();
_childMessage = childMessage;
}
示例10: Time
private void Time(IMessage[] messages, IMessageSerializer serializer) {
Stopwatch watch = new Stopwatch();
watch.Start();
for (int i = 0; i < numberOfIterations; i++)
using (MemoryStream stream = new MemoryStream())
serializer.Serialize(messages, stream);
watch.Stop();
Debug.WriteLine("Serializing: " + watch.Elapsed);
watch.Reset();
MemoryStream s = new MemoryStream();
serializer.Serialize(messages, s);
byte[] buffer = s.GetBuffer();
s.Dispose();
Console.WriteLine(Encoding.ASCII.GetString(buffer));
watch.Start();
object[] result = null;
for (int i = 0; i < numberOfIterations; i++)
using (var forDeserializing = new MemoryStream(buffer))
result = serializer.Deserialize(forDeserializing);
watch.Stop();
Debug.WriteLine("Deserializing: " + watch.Elapsed);
}
示例11: RabbitMqSendEndpointProvider
public RabbitMqSendEndpointProvider(IMessageSerializer serializer, Uri inputAddress, ISendTransportProvider transportProvider)
{
_inputAddress = inputAddress;
_transportProvider = transportProvider;
_serializer = serializer;
_sendObservable = new SendObservable();
}
示例12: RhinoQueuesOneWayBus
public RhinoQueuesOneWayBus(MessageOwner[] messageOwners, IMessageSerializer messageSerializer, string path, bool enablePerformanceCounters, IMessageBuilder<MessagePayload> messageBuilder, QueueManagerConfiguration queueManagerConfiguration)
: base(NullEndpoint, new EndpointRouter(), messageSerializer, 1, path, IsolationLevel.ReadCommitted, 5, enablePerformanceCounters, messageBuilder, queueManagerConfiguration)
{
this.messageOwners = new MessageOwnersSelector(messageOwners, new EndpointRouter());
Start();
}
示例13: Initialize
protected override void Initialize(IMessageSerializer messageSerializer)
{
try
{
this.socket = new ClientWebSocket();
this.socket.ConnectAsync(new Uri(serverUrl), CancellationToken.None).Wait();
}
catch (AggregateException ex)
{
var wsException= ex.InnerExceptions.FirstOrDefault() as WebSocketException;
if (wsException != null)
{
Logger.Write(LogLevel.Warning,
string.Format("Failed to connect to WebSocket server. Error was '{0}'", wsException.Message));
}
throw;
}
this.inputStream = new ClientWebSocketStream(socket);
this.outputStream = new ClientWebSocketStream(socket);
// Set up the message reader and writer
this.MessageReader =
new MessageReader(
this.inputStream,
messageSerializer);
this.MessageWriter =
new MessageWriter(
this.outputStream,
messageSerializer);
}
示例14: ServiceBusSendEndpointProvider
public ServiceBusSendEndpointProvider(IMessageSerializer serializer, Uri sourceAddress, ISendTransportProvider transportProvider)
{
_transportProvider = transportProvider;
_sourceAddress = sourceAddress;
_serializer = serializer;
_sendObservable = new SendObservable();
}
示例15: MsmqTransport
public MsmqTransport(IMessageSerializer serializer, IQueueStrategy queueStrategy, Uri endpoint, int threadCount, IMsmqTransportAction[] transportActions, IEndpointRouter endpointRouter, IsolationLevel queueIsolationLevel, TransactionalOptions transactional, bool consumeInTransaction)
: base(queueStrategy, endpoint, threadCount, serializer, endpointRouter, transactional)
{
this.transportActions = transportActions;
this.queueIsolationLevel = queueIsolationLevel;
this.consumeInTransaction = consumeInTransaction;
}