private static void Initialize() { _messageFactory = TweetinviContainer.Resolve<IMessageFactory>(); _messageController = TweetinviContainer.Resolve<IMessageController>(); _messageGetLatestsReceivedRequestParametersFactory = TweetinviContainer.Resolve<IFactory<IMessageGetLatestsReceivedRequestParameters>>(); _messageGetLatestsSentRequestParametersFactory = TweetinviContainer.Resolve<IFactory<IMessageGetLatestsSentRequestParameters>>(); }
public SessionFactory(IApplication app, IMessageStoreFactory storeFactory, ILogFactory logFactory, IMessageFactory messageFactory) { application_ = app; messageStoreFactory_ = storeFactory; logFactory_ = logFactory; messageFactory_ = messageFactory ?? new DefaultMessageFactory(); }
/// <summary> /// Initializes a new instance of the <see cref="OpenIdChannel"/> class. /// </summary> /// <param name="messageTypeProvider">A class prepared to analyze incoming messages and indicate what concrete /// message types can deserialize from it.</param> /// <param name="bindingElements">The binding elements to use in sending and receiving messages.</param> protected OpenIdChannel(IMessageFactory messageTypeProvider, IChannelBindingElement[] bindingElements) : base(messageTypeProvider, bindingElements) { Requires.NotNull(messageTypeProvider, "messageTypeProvider"); // Customize the binding element order, since we play some tricks for higher // security and backward compatibility with older OpenID versions. var outgoingBindingElements = new List<IChannelBindingElement>(bindingElements); var incomingBindingElements = new List<IChannelBindingElement>(bindingElements); incomingBindingElements.Reverse(); // Customize the order of the incoming elements by moving the return_to elements in front. var backwardCompatibility = incomingBindingElements.OfType<BackwardCompatibilityBindingElement>().SingleOrDefault(); var returnToSign = incomingBindingElements.OfType<ReturnToSignatureBindingElement>().SingleOrDefault(); if (backwardCompatibility != null) { incomingBindingElements.MoveTo(0, backwardCompatibility); } if (returnToSign != null) { // Yes, this is intentionally, shifting the backward compatibility // binding element to second position. incomingBindingElements.MoveTo(0, returnToSign); } this.CustomizeBindingElementOrder(outgoingBindingElements, incomingBindingElements); // Change out the standard web request handler to reflect the standard // OpenID pattern that outgoing web requests are to unknown and untrusted // servers on the Internet. this.WebRequestHandler = new UntrustedWebRequestHandler(); }
public OrderController(IRepository<Order> orderRepository, IMessageFactory messageFactory) { Check.Require(orderRepository != null); _orderRepository = orderRepository; _messageFactory = messageFactory; }
/// <summary> /// Initializes a new instance of the <see cref="Connection"/> class. /// </summary> /// <param name="host">Hostname of the server</param> /// <param name="port">Port on which the server is listening</param> /// <param name="messageFactory">Protobuf message factory</param> public Connection(string host, int port, IMessageFactory messageFactory) { this.host = host; this.port = port; this.messageFactory = messageFactory; this.Connected = false; }
public MessageController( IMessageQueryExecutor messageQueryExecutor, IMessageFactory messageFactory) { _messageQueryExecutor = messageQueryExecutor; _messageFactory = messageFactory; }
public ConnectedState(RC4Encryptor encryptor, IMessageFactory messageFactory) { this.encryptor = encryptor; this.messageFactory = messageFactory; this.compressor = new LZ4Compressor(); }
public static async Task<Message> Simple(IMessageFactory msgFactory, object target, Message input) { var msg = (ISomeServiceSimpleRequest)input; var retVal = await ((ISomeService)target).Simple(msg.requestId); var retMsg = msgFactory.New<ISomeServiceSimpleReply>(); retMsg.RetVal = retVal; return retMsg; }
public SocketInitiator(Application application, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory, IMessageFactory messageFactory) : base(application, storeFactory, settings, logFactory, messageFactory) { app_ = application; storeFactory_ = storeFactory; settings_ = settings; logFactory_ = logFactory; }
public static async Task<Message> Complex(IMessageFactory msgFactory, object target, Message input) { var msg = (ISomeServiceComplexRequest)input; var retVal = await ((ISomeService)target).Complex(msg.requestId, msg.data, msg.name, msg.datas); var retMsg = msgFactory.New<ISomeServiceComplexReply>(); retMsg.RetVal = retVal; return retMsg; }
public static async Task<Message> Login(IMessageFactory msgFactory, object target, Message input) { var msg = (IChatLoginLoginRequest)input; var retVal = await ((IChatLogin)target).Login(msg.name); var retMsg = msgFactory.New<IChatLoginLoginReply>(); retMsg.RetVal = retVal; return retMsg; }
public static async Task<Message> GetRooms(IMessageFactory msgFactory, object target, Message input) { var msg = (IChatServiceGetRoomsRequest)input; var retVal = await ((IChatService)target).GetRooms(); var retMsg = msgFactory.New<IChatServiceGetRoomsReply>(); retMsg.RetVal = retVal; return retMsg; }
public Session( IApplication app, IMessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider, SessionSchedule sessionSchedule, int heartBtInt, ILogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID) { this.Application = app; this.SessionID = sessID; this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider); this.schedule_ = sessionSchedule; this.msgFactory_ = msgFactory; this.SenderDefaultApplVerID = senderDefaultApplVerID; this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString); if (this.SessionID.IsFIXT) this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID); else this.ApplicationDataDictionary = this.SessionDataDictionary; ILog log; if (null != logFactory) log = logFactory.Create(sessID); else log = new NullLog(); state_ = new SessionState(log, heartBtInt) { MessageStore = storeFactory.Create(sessID) }; // Configuration defaults. // Will be overridden by the SessionFactory with values in the user's configuration. this.PersistMessages = true; this.ResetOnDisconnect = false; this.SendRedundantResendRequests = false; this.ValidateLengthAndChecksum = true; this.CheckCompID = true; this.MillisecondsInTimeStamp = true; this.EnableLastMsgSeqNumProcessed = false; this.MaxMessagesInResendRequest = 0; this.SendLogoutBeforeTimeoutDisconnect = false; this.IgnorePossDupResendRequests = false; this.RequiresOrigSendingTime = true; this.CheckLatency = true; this.MaxLatency = 120; if (!IsSessionTime) Reset("Out of SessionTime (Session construction)"); else if (IsNewSession) Reset("New session"); lock (sessions_) { sessions_[this.SessionID] = this; } this.Application.OnCreate(this.SessionID); this.Log.OnEvent("Created session"); }
public ServeController(IServeService serveService, IConfigurationWrapper configuration, IMessageFactory messageFactory, IMessageQueueFactory messageQueueFactory) { _serveService = serveService; _messageFactory = messageFactory; var eventQueueName = configuration.GetConfigValue("SignupToServeEventQueue"); _eventQueue = messageQueueFactory.CreateQueue(eventQueueName, QueueAccessMode.Send); _messageFactory = messageFactory; }
public MainWindowViewModel( IQueueManager queueManager, IMessageFactory factory) { this.queueManager = queueManager; this.messageFactory = factory; this.PoppedMessage = string.Empty; }
public TripApplicationController(ITripService tripService, IConfigurationWrapper configuration, IMessageFactory messageFactory, IMessageQueueFactory messageQueueFactory) { _tripService = tripService; _messageFactory = messageFactory; var eventQueueName = configuration.GetConfigValue("TripApplicationEventQueue"); _eventQueue = messageQueueFactory.CreateQueue(eventQueueName, QueueAccessMode.Send); _messageFactory = messageFactory; }
/// <summary> /// Initializes a new instance of the <see cref="CoordinatingHttpRequestInfo"/> class /// that will generate a message when the <see cref="Message"/> property getter is called. /// </summary> /// <param name="channel">The channel.</param> /// <param name="messageFactory">The message factory.</param> /// <param name="messageData">The message data.</param> /// <param name="recipient">The recipient.</param> internal CoordinatingHttpRequestInfo(Channel channel, IMessageFactory messageFactory, IDictionary<string, string> messageData, MessageReceivingEndpoint recipient) : this(recipient) { Contract.Requires(channel != null); Contract.Requires(messageFactory != null); Contract.Requires(messageData != null); this.channel = channel; this.messageFactory = messageFactory; this.messageData = messageData; }
/// <summary> /// Register a new message factory for a MIME type /// </summary> /// <param name="mimeType">Mime type to register</param> /// <param name="mf"></param> public void RegisterFactory(string mimeType, IMessageFactory mf) { if ( mf == null ) throw new ArgumentNullException("mf"); if ( mimeType == null || mimeType.Length == 0 ) throw new ArgumentNullException("mimeType"); _mimeToFactoryMap[mimeType] = mf; }
public override void SetUp() { base.SetUp(); var authServerChannel = new OAuth2AuthorizationServerChannel(new Mock<IAuthorizationServer>().Object); this.authServerMessageFactory = authServerChannel.MessageFactoryTestHook; var clientChannel = new OAuth2ClientChannel(); this.clientMessageFactory = clientChannel.MessageFactoryTestHook; }
/// <summary> /// Initializes a new instance of the <see cref="OAuthChannel"/> class. /// </summary> /// <param name="signingBindingElement">The binding element to use for signing.</param> /// <param name="store">The web application store to use for nonces.</param> /// <param name="tokenManager">The ITokenManager instance to use.</param> /// <param name="messageTypeProvider"> /// An injected message type provider instance. /// Except for mock testing, this should always be one of /// <see cref="OAuthConsumerMessageFactory"/> or <see cref="OAuthServiceProviderMessageFactory"/>. /// </param> internal OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, IMessageFactory messageTypeProvider) : base(messageTypeProvider, InitializeBindingElements(signingBindingElement, store, tokenManager)) { Contract.Requires<ArgumentNullException>(tokenManager != null); Contract.Requires<ArgumentNullException>(signingBindingElement != null); Contract.Requires<ArgumentException>(signingBindingElement.SignatureCallback == null, OAuthStrings.SigningElementAlreadyAssociatedWithChannel); this.TokenManager = tokenManager; signingBindingElement.SignatureCallback = this.SignatureCallback; }
/// <summary> /// Initializes a new instance of the <see cref="OAuthChannel"/> class. /// </summary> /// <param name="signingBindingElement">The binding element to use for signing.</param> /// <param name="store">The web application store to use for nonces.</param> /// <param name="tokenManager">The ITokenManager instance to use.</param> /// <param name="messageTypeProvider"> /// An injected message type provider instance. /// Except for mock testing, this should always be one of /// <see cref="OAuthConsumerMessageFactory"/> or <see cref="OAuthServiceProviderMessageFactory"/>. /// </param> internal OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, IMessageFactory messageTypeProvider) : base(messageTypeProvider, InitializeBindingElements(signingBindingElement, store, tokenManager)) { ErrorUtilities.VerifyArgumentNotNull(tokenManager, "tokenManager"); this.TokenManager = tokenManager; ErrorUtilities.VerifyArgumentNamed(signingBindingElement.SignatureCallback == null, "signingBindingElement", OAuthStrings.SigningElementAlreadyAssociatedWithChannel); signingBindingElement.SignatureCallback = this.SignatureCallback; }
internal OAuthConsumerChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, IConsumerTokenManager tokenManager, ConsumerSecuritySettings securitySettings, IMessageFactory messageFactory = null) : base( signingBindingElement, tokenManager, securitySettings, messageFactory ?? new OAuthConsumerMessageFactory(), InitializeBindingElements(signingBindingElement, store)) { Requires.NotNull(tokenManager, "tokenManager"); Requires.NotNull(securitySettings, "securitySettings"); Requires.NotNull(signingBindingElement, "signingBindingElement"); }
protected OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, ITokenManager tokenManager, SecuritySettings securitySettings, IMessageFactory messageTypeProvider, IChannelBindingElement[] bindingElements) : base(messageTypeProvider, bindingElements) { Requires.NotNull(tokenManager, "tokenManager"); Requires.NotNull(securitySettings, "securitySettings"); Requires.NotNull(signingBindingElement, "signingBindingElement"); Requires.That(signingBindingElement.SignatureCallback == null, "signingBindingElement", OAuthStrings.SigningElementAlreadyAssociatedWithChannel); Requires.NotNull(bindingElements, "bindingElements"); this.TokenManager = tokenManager; signingBindingElement.SignatureCallback = this.SignatureCallback; }
internal OAuthServiceProviderChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, IServiceProviderTokenManager tokenManager, ServiceProviderSecuritySettings securitySettings, IMessageFactory messageTypeProvider = null) : base( signingBindingElement, tokenManager, securitySettings, messageTypeProvider ?? new OAuthServiceProviderMessageFactory(tokenManager), InitializeBindingElements(signingBindingElement, store, tokenManager, securitySettings)) { Requires.NotNull(tokenManager, "tokenManager"); Requires.NotNull(securitySettings, "securitySettings"); Requires.NotNull(signingBindingElement, "signingBindingElement"); }
/// <summary> /// Initializes a new instance of the <see cref="OAuthChannel"/> class. /// </summary> /// <param name="signingBindingElement">The binding element to use for signing.</param> /// <param name="store">The web application store to use for nonces.</param> /// <param name="tokenManager">The ITokenManager instance to use.</param> /// <param name="messageTypeProvider"> /// An injected message type provider instance. /// Except for mock testing, this should always be one of /// <see cref="OAuthConsumerMessageFactory"/> or <see cref="OAuthServiceProviderMessageFactory"/>. /// </param> /// <remarks> /// This overload for testing purposes only. /// </remarks> internal OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, IMessageFactory messageTypeProvider) : base(messageTypeProvider, new OAuthHttpMethodBindingElement(), signingBindingElement, new StandardExpirationBindingElement(), new StandardReplayProtectionBindingElement(store)) { if (tokenManager == null) { throw new ArgumentNullException("tokenManager"); } this.TokenManager = tokenManager; ErrorUtilities.VerifyArgumentNamed(signingBindingElement.SignatureCallback == null, "signingBindingElement", OAuthStrings.SigningElementAlreadyAssociatedWithChannel); signingBindingElement.SignatureCallback = this.SignatureCallback; }
public AbstractInitiator( IApplication app, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory) { _app = app; _storeFactory = storeFactory; _settings = settings; _logFactory = logFactory; _msgFactory = messageFactory; HashSet<SessionID> definedSessions = _settings.GetSessions(); if (0 == definedSessions.Count) throw new ConfigError("No sessions defined"); }
/// FIXME public Session( Application app, MessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider, SessionSchedule sessionSchedule, int heartBtInt, LogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID) { this.Application = app; this.SessionID = sessID; this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider); this.schedule_ = sessionSchedule; this.msgFactory_ = msgFactory; this.SenderDefaultApplVerID = senderDefaultApplVerID; this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString); if (this.SessionID.IsFIXT) this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID); else this.ApplicationDataDictionary = this.SessionDataDictionary; Log log; if (null != logFactory) log = logFactory.Create(sessID); else log = new NullLog(); state_ = new SessionState(log, heartBtInt) { MessageStore = storeFactory.Create(sessID) }; this.PersistMessages = true; this.ResetOnDisconnect = false; this.SendRedundantResendRequests = false; this.ValidateLengthAndChecksum = true; this.CheckCompID = true; this.MillisecondsInTimeStamp = true; this.EnableLastMsgSeqNumProcessed = false; this.MaxMessagesInResendRequest = 0; this.SendLogoutBeforeTimeoutDisconnect = false; this.IgnorePossDupResendRequests = false; if (!IsSessionTime) Reset(); lock (sessions_) { sessions_[this.SessionID] = this; } this.Application.OnCreate(this.SessionID); this.Log.OnEvent("Created session"); }
/// <summary> /// Initializes a new instance of the <see cref="CoordinatingHttpRequestInfo"/> class /// that will generate a message when the <see cref="Message"/> property getter is called. /// </summary> /// <param name="channel">The channel.</param> /// <param name="messageFactory">The message factory.</param> /// <param name="messageData">The message data.</param> /// <param name="recipient">The recipient.</param> /// <param name="cookies">Cookies included in the incoming request.</param> internal CoordinatingHttpRequestInfo( Channel channel, IMessageFactory messageFactory, IDictionary<string, string> messageData, MessageReceivingEndpoint recipient, HttpCookieCollection cookies) : this(recipient, cookies) { Requires.NotNull(channel, "channel"); Requires.NotNull(messageFactory, "messageFactory"); Requires.NotNull(messageData, "messageData"); this.channel = channel; this.messageData = messageData; this.messageFactory = messageFactory; }
public MessageDeQueue(IHeaders headers, IMessageFactory messageFactory, IReceivedMessageFactory receivedMessageFactory, ICompositeSerialization serialization) { Guard.NotNull(() => serialization, serialization); Guard.NotNull(() => headers, headers); Guard.NotNull(() => messageFactory, messageFactory); Guard.NotNull(() => receivedMessageFactory, receivedMessageFactory); _messageFactory = messageFactory; _headers = headers; _serialization = serialization; _receivedMessageFactory = receivedMessageFactory; }
internal MessageBuilder( string msgStr, bool validateLengthAndChecksum, DataDictionary.DataDictionary sessionDD, DataDictionary.DataDictionary appDD, IMessageFactory msgFactory) { _msgStr = msgStr; _validateLengthAndChecksum = validateLengthAndChecksum; _sessionDD = sessionDD; _appDD = appDD; _msgFactory = msgFactory; _msgType = Message.IdentifyType(_msgStr); _beginString = Message.ExtractBeginString(_msgStr); }
public AbstractInitiator( IApplication app, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory) { _app = app; _storeFactory = storeFactory; _settings = settings; _logFactory = logFactory; _msgFactory = messageFactory; HashSet <SessionID> definedSessions = _settings.GetSessions(); if (0 == definedSessions.Count) { throw new ConfigError("No sessions defined"); } }
/// <summary> /// Sends a newsletter subscription activation message. /// </summary> public static Task <CreateMessageResult> SendNewsletterSubscriptionActivationMessageAsync(this IMessageFactory factory, NewsletterSubscription subscription, int languageId = 0) { Guard.NotNull(subscription, nameof(subscription)); return(factory.CreateMessageAsync(MessageContext.Create(MessageTemplateNames.NewsLetterSubscriptionActivation, languageId), true, subscription)); }
/// <summary> /// Creates a remote executor factory using the specified message factory. /// </summary> /// <param name="messageFactory"></param> public RemoteExecutorFactory(IMessageFactory messageFactory) { _messageFactory = messageFactory; }
public TwoWayRemoteCallInterceptor(IOutputChannel channel, IMessageDispatcher messageDispatcher, IMessageFactory messageFactory, string interfaceName, RemoteExecutionPolicies policies) { _interfaceName = interfaceName; _channel = channel; _durableConnection = _channel as IDurableConnection; _messageDispatcher = messageDispatcher; _policies = policies; _messageFactory = messageFactory; GenerateNewCancellationToken(); if (_durableConnection != null) { _durableConnection.ConnectionAborted += () => { _tokenSource.Aborted = true; _tokenSource.Cancel(); }; _durableConnection.ConnectionRestored += () => { _tokenSource.Restored = true; _tokenSource.Cancel(); GenerateNewCancellationToken(); }; _durableConnection.ConnectionInterrupted += () => { _tokenSource.Cancel(); GenerateNewCancellationToken(); }; } }
public ServeController(IServeService serveService, IConfigurationWrapper configuration, IMessageFactory messageFactory, IMessageQueueFactory messageQueueFactory, IUserImpersonationService userImpersonationService) : base(userImpersonationService) { _serveService = serveService; _messageFactory = messageFactory; var eventQueueName = configuration.GetConfigValue("SignupToServeEventQueue"); _eventQueue = messageQueueFactory.CreateQueue(eventQueueName, QueueAccessMode.Send); _messageFactory = messageFactory; }
public SocketInitiator(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory) : base(application, storeFactory, settings, logFactory, messageFactory) { }
public ThreadedSocketAcceptor(IApplication application, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory) : this(new SessionFactory(application, storeFactory, logFactory, messageFactory), settings) { }
/// <summary> /// Initializes a new instance of the <see cref="OAuthChannel"/> class. /// </summary> /// <param name="signingBindingElement">The binding element to use for signing.</param> /// <param name="store">The web application store to use for nonces.</param> /// <param name="tokenManager">The ITokenManager instance to use.</param> /// <param name="messageTypeProvider"> /// An injected message type provider instance. /// Except for mock testing, this should always be one of /// <see cref="OAuthConsumerMessageFactory"/> or <see cref="OAuthServiceProviderMessageFactory"/>. /// </param> internal OAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, IMessageFactory messageTypeProvider) : base(messageTypeProvider, InitializeBindingElements(signingBindingElement, store, tokenManager)) { Contract.Requires <ArgumentNullException>(tokenManager != null); Contract.Requires <ArgumentNullException>(signingBindingElement != null); Contract.Requires <ArgumentException>(signingBindingElement.SignatureCallback == null, OAuthStrings.SigningElementAlreadyAssociatedWithChannel); this.TokenManager = tokenManager; signingBindingElement.SignatureCallback = this.SignatureCallback; }
public InstantViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IMessageFactory messageFactory, IEventAggregator aggregator) : base(protoService, cacheService, settingsService, aggregator) { _messageFactory = messageFactory; _gallery = new InstantGalleryViewModel(protoService, aggregator); ShareCommand = new RelayCommand(ShareExecute); FeedbackCommand = new RelayCommand(FeedbackExecute); BrowserCommand = new RelayCommand(BrowserExecute); CopyCommand = new RelayCommand(CopyExecute); }
private void ProcessesNewConnection(Socket socket) { if (log.IsDebugEnabled) { log.Debug("--> ProcessesNewConnection"); } bool bSuccess = false; IEngine engine; if (log.IsDebugEnabled) { log.DebugFormat("ProcessesNewConnection - Connection information / LocalEndPoint={0} RemoteEndPoint={1}", socket.LocalEndPoint, socket.RemoteEndPoint); } try { DateTime dtTimeout = DateTime.Now.AddSeconds(_iConnectTimeout); byte[] buffer = new byte[4096]; int iLenReceive; StringBuilder sbReceive = new StringBuilder(); while (!_bIsDisposed && DateTime.Now < dtTimeout && socket.Connected && (sbReceive.Length == 0 || socket.Available > 0)) { if (socket.Available > 0) { iLenReceive = socket.Receive(buffer); if (iLenReceive > 0) { for (int i = 0; i < iLenReceive; i++) { sbReceive.Append((char)buffer[i]); } } } else { Thread.Sleep(100); } } if (sbReceive.Length > 0) { string sMessage = sbReceive.ToString(); if (log.IsDebugEnabled) { log.DebugFormat("ProcessesNewConnection - Received message / Message={0}", sMessage); } IMessage message = null; //Find corresponding engine for message engine = FindRelatedEngine(sMessage); if (engine != null) { IMessageFactory messageFactory = engine.MessageFactory; //Validate CheckSum and BodyLen in message if (!messageFactory.ValidateFixChecksum(sMessage)) { log.Warn("ProcessesNewConnection - Message failed check sum validation"); } else if (!messageFactory.ValidateBodyLength(sMessage)) { log.Warn("ProcessesNewConnection - Message failed body lenght validation"); } else { //Parse string to a message object if (log.IsDebugEnabled) { log.DebugFormat("ProcessesNewConnection - Parsing string to message object"); } message = messageFactory.Parse(sMessage); message.Direction = MessageDirection.In; //Check message recieved is a Logon if (!messageFactory.IsLogonMessage(message)) { if (log.IsWarnEnabled) { log.Warn("ProcessesNewConnection - Message parsed is not a logon type"); } message = null; } } } else { log.Warn("ProcessesNewConnection - Could not find a related engine to process logon message"); } if (message != null) { SocketLogonArgs args = new SocketLogonArgs(); args.Socket = socket; args.MessageLogon = (IMessageLogon)message; engine.Logon(args); bSuccess = engine.IsConnected; } } else { if (log.IsWarnEnabled) { log.Warn("ProcessesNewConnection - Nothing was received from new connection"); } } } catch (Exception ex) { log.Error("ProcessesNewConnection - Exception caught", ex); } if (!bSuccess) { log.Info("ProcessesNewConnection - Failed to establish new connection"); try { socket.Close(); } catch (Exception ex) { log.Error("ProcessesNewConnection - Error closing a failed connection", ex); } } if (log.IsDebugEnabled) { log.Debug("<-- ProcessesNewConnection"); } }
/// <summary> /// Create a new <see cref="Response"/> for this IRequest. /// </summary> /// <param name="factory"> /// The <see cref="IMessageFactory"/> that must be used to create the /// returned <b>Response</b>; never <c>null</c>. /// </param> /// <returns> /// A new <b>Response</b>. /// </returns> protected override Response InstantiateResponse(IMessageFactory factory) { return((Response)factory.CreateMessage(InternalResponse.TYPE_ID)); }
public DialogThreadViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, ILocationService locationService, INotificationsService pushService, IPlaybackService playbackService, IVoIPService voipService, INetworkService networkService, IMessageFactory messageFactory) : base(protoService, cacheService, settingsService, aggregator, locationService, pushService, playbackService, voipService, networkService, messageFactory) { }
public TopicClient(IMessageFactory messageFactory, IConfiguration configuration) { _messageFactory = messageFactory; _connectionString = configuration.GetConnectionString("KledexMessageBus"); }
public QueueClient(IMessageFactory messageFactory, IOptions <ServiceBusConfiguration> serviceBusConfiguration) { _messageFactory = messageFactory; _connectionString = serviceBusConfiguration.Value.ConnectionString; }