Show / Hide Table of Contents

# Class MessageDispatcher

##### Inheritance

System.Object
MessageDispatcher

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace:Microsoft.SqlTools.ServiceLayer.Hosting.Protocol

###### Assembly:Microsoft.SqlTools.ServiceLayer.dll

##### Syntax

    public class MessageDispatcher

### Constructors

| Improve this Doc View Source

#### MessageDispatcher(ChannelBase)

##### Declaration

    public MessageDispatcher(ChannelBase protocolChannel)

##### Parameters

Type | Name | Description
--- | --- | ---
ChannelBase | protocolChannel |

### Properties

| Improve this Doc View Source

#### InMessageLoopThread

##### Declaration

    public bool InMessageLoopThread { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### MessageReader

##### Declaration

    protected MessageReader MessageReader { get; }

##### Property Value

Type | Description
--- | ---
MessageReader |

| Improve this Doc View Source

#### MessageWriter

##### Declaration

    protected MessageWriter MessageWriter { get; }

##### Property Value

Type | Description
--- | ---
MessageWriter |

| Improve this Doc View Source

#### SynchronizationContext

##### Declaration

    public SynchronizationContext SynchronizationContext { get; }

##### Property Value

Type | Description
--- | ---
System.Threading.SynchronizationContext |

### Methods

| Improve this Doc View Source

#### DispatchMessage(Message, MessageWriter)

##### Declaration

    protected Task DispatchMessage(Message messageToDispatch, MessageWriter messageWriter)

##### Parameters

Type | Name | Description
--- | --- | ---
Message | messageToDispatch |
MessageWriter | messageWriter |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### OnUnhandledException(Exception)

##### Declaration

    protected void OnUnhandledException(Exception unhandledException)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Exception | unhandledException |

| Improve this Doc View Source

#### SetEventHandler<TParams>(EventType<TParams>, Func<TParams, EventContext, Task>)

##### Declaration

    public void SetEventHandler<TParams>(EventType<TParams> eventType, Func<TParams, EventContext, Task> eventHandler)

##### Parameters

Type | Name | Description
--- | --- | ---
EventType<TParams> | eventType |
System.Func<TParams, EventContext, System.Threading.Tasks.Task> | eventHandler |

##### Type Parameters

Name | Description
--- | ---
TParams |

| Improve this Doc View Source

#### SetEventHandler<TParams>(EventType<TParams>, Func<TParams, EventContext, Task>, Boolean)

##### Declaration

    public void SetEventHandler<TParams>(EventType<TParams> eventType, Func<TParams, EventContext, Task> eventHandler, bool overrideExisting)

##### Parameters

Type | Name | Description
--- | --- | ---
EventType<TParams> | eventType |
System.Func<TParams, EventContext, System.Threading.Tasks.Task> | eventHandler |
System.Boolean | overrideExisting |

##### Type Parameters

Name | Description
--- | ---
TParams |

| Improve this Doc View Source

#### SetRequestHandler<TParams, TResult>(RequestType<TParams, TResult>, Func<TParams, RequestContext<TResult>, Task>)

##### Declaration

    public void SetRequestHandler<TParams, TResult>(RequestType<TParams, TResult> requestType, Func<TParams, RequestContext<TResult>, Task> requestHandler)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestType<TParams, TResult> | requestType |
System.Func<TParams, RequestContext<TResult>, System.Threading.Tasks.Task> | requestHandler |

##### Type Parameters

Name | Description
--- | ---
TParams |
TResult |

| Improve this Doc View Source

#### SetRequestHandler<TParams, TResult>(RequestType<TParams, TResult>, Func<TParams, RequestContext<TResult>, Task>, Boolean)

##### Declaration

    public void SetRequestHandler<TParams, TResult>(RequestType<TParams, TResult> requestType, Func<TParams, RequestContext<TResult>, Task> requestHandler, bool overrideExisting)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestType<TParams, TResult> | requestType |
System.Func<TParams, RequestContext<TResult>, System.Threading.Tasks.Task> | requestHandler |
System.Boolean | overrideExisting |

##### Type Parameters

Name | Description
--- | ---
TParams |
TResult |

| Improve this Doc View Source

#### SetResponseHandler(Action<Message>)

##### Declaration

    public void SetResponseHandler(Action<Message> responseHandler)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Action<Message> | responseHandler |

| Improve this Doc View Source

#### Start()

##### Declaration

    public void Start()

| Improve this Doc View Source

#### Stop()

##### Declaration

    public void Stop()

### Events

| Improve this Doc View Source

#### UnhandledException

##### Declaration

    public event EventHandler<Exception> UnhandledException

##### Event Type

Type | Description
--- | ---
System.EventHandler<System.Exception> |