System.Collections.Concurrent.BlockingCollection.TryAdd(CronusMessage)

Here are the examples of the csharp api class System.Collections.Concurrent.BlockingCollection.TryAdd(CronusMessage) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: Cronus
Source File: InMemoryPipelineTransport.cs
public void SendMessage(IPipeline pipeline, CronusMessage message)
        {
            ConcurrentDictionary<IEndpoint, BlockingCollection<CronusMessage>> endpointStorage;
            if (pipelineStorage.TryGetValue(pipeline, out endpointStorage))
            {
                var messageType = message.Payload.GetType().GetContractId();

                foreach (var store in endpointStorage)
                {
                    var endpoint = store.Key as InMemoryEndpoint;

                    if (endpoint == null || !endpoint.WatchMessageTypes.Contains(messageType))
                    {
                        continue;
                    }

                    store.Value.TryAdd(message);
                }
            }
        }