当前位置: 首页>>代码示例>>C#>>正文


C# IMessageSerializer类代码示例

本文整理汇总了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);
        }
开发者ID:helge,项目名称:rhino-esb,代码行数:34,代码来源:AbstractMsmqListener.cs

示例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));
        }
开发者ID:BiYiTuan,项目名称:rhino-esb,代码行数:25,代码来源:MessageLoggingTests.cs

示例3: ActiveMqMessageMapper

 public ActiveMqMessageMapper(IMessageSerializer serializer, IMessageTypeInterpreter messageTypeInterpreter, IActiveMqMessageEncoderPipeline encoderPipeline, IActiveMqMessageDecoderPipeline decoderPipeline)
 {
     this.serializer = serializer;
     this.messageTypeInterpreter = messageTypeInterpreter;
     this.encoderPipeline = encoderPipeline;
     this.decoderPipeline = decoderPipeline;
 }
开发者ID:afyles,项目名称:NServiceBus,代码行数:7,代码来源:ActiveMqMessageMapper.cs

示例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;
 }
开发者ID:GitItInTheHub,项目名称:Griffin.Framework,代码行数:12,代码来源:MicroMessageDecoder.cs

示例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();
 }
开发者ID:Rurouni,项目名称:MassiveOnlineUniversalServerEngine,代码行数:7,代码来源:AsyncProcessingNetChannel.cs

示例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);
        }
开发者ID:BclEx,项目名称:rhino-esb,代码行数:30,代码来源:RhinoFilesTransport.cs

示例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;
            };
        }
开发者ID:bibendus,项目名称:Roger,代码行数:28,代码来源:AbstractDeliveryFactory.cs

示例8: DefaultAsyncEventPublisher

 public DefaultAsyncEventPublisher(ISubscriptionStore subscriptionStore, IMessageTransport messageTransport, IMessageSerializer messageSerializer, ILoggerFactory loggerFactory)
 {
     _subscriptionStore = subscriptionStore;
     _messageTransport = messageTransport;
     _messageSerializer = messageSerializer;
     _logger = loggerFactory.Create("EventSourcing.DefaultAsyncEventPublisher");
 }
开发者ID:tangxuehua,项目名称:eventsourcing,代码行数:7,代码来源:DefaultAsyncEventPublisher.cs

示例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;
        }
开发者ID:lsoft,项目名称:XLogger,代码行数:34,代码来源:CLogMessage.cs

示例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);
        }
开发者ID:jdaigle,项目名称:CWServiceBus,代码行数:30,代码来源:NamespaceTests.cs

示例11: RabbitMqSendEndpointProvider

 public RabbitMqSendEndpointProvider(IMessageSerializer serializer, Uri inputAddress, ISendTransportProvider transportProvider)
 {
     _inputAddress = inputAddress;
     _transportProvider = transportProvider;
     _serializer = serializer;
     _sendObservable = new SendObservable();
 }
开发者ID:nicklv,项目名称:MassTransit,代码行数:7,代码来源:RabbitMqSendEndpointProvider.cs

示例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();
        }
开发者ID:BiYiTuan,项目名称:rhino-esb,代码行数:7,代码来源:RhinoQueuesOneWayBus.cs

示例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);
        }
开发者ID:modulexcite,项目名称:PowerShellEditorServices,代码行数:34,代码来源:WebsocketClientChannel.cs

示例14: ServiceBusSendEndpointProvider

 public ServiceBusSendEndpointProvider(IMessageSerializer serializer, Uri sourceAddress, ISendTransportProvider transportProvider)
 {
     _transportProvider = transportProvider;
     _sourceAddress = sourceAddress;
     _serializer = serializer;
     _sendObservable = new SendObservable();
 }
开发者ID:nicklv,项目名称:MassTransit,代码行数:7,代码来源:ServiceBusSendEndpointProvider.cs

示例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;
 }
开发者ID:philiphoy,项目名称:rhino-esb,代码行数:7,代码来源:MsmqTransport.cs


注:本文中的IMessageSerializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。