Beispiel #1
0
 /// <summary>
 /// Creates the fake advanced API, using the given implementation(s). All arguments are optional
 /// </summary>
 public FakeAdvancedApi(IWorkersApi workers = null, ITopicsApi topics = null, IRoutingApi routing = null, ITransportMessageApi transportMessage = null, IDataBus dataBus = null)
 {
     _workers = workers;
     _topics = topics;
     _routing = routing;
     _transportMessage = transportMessage;
     _dataBus = dataBus;
 }
Beispiel #2
0
 /// <summary>
 /// Creates the fake advanced API, using the given implementation(s). All arguments are optional
 /// </summary>
 public FakeAdvancedApi(IWorkersApi workers = null, ITopicsApi topics = null, IRoutingApi routing = null, ITransportMessageApi transportMessage = null, IDataBus dataBus = null)
 {
     _workers          = workers;
     _topics           = topics;
     _routing          = routing;
     _transportMessage = transportMessage;
     _dataBus          = dataBus;
 }
        /// <summary>
        /// Register a specifc message in a specific queue.
        /// </summary>
        /// <param name="routingApi"></param>
        /// <param name="address">Address of destination queue, this is the producer of the message</param>
        /// <param name="messageType">Type of message we are interested into</param>
        /// <param name="subscriberAddress">Address of this process, usually taken from <see cref="JarvisRebusConfiguration.TransportAddress"/></param>
        public static Task Subscribe(this IRoutingApi routingApi, String address, Type messageType, String subscriberAddress)
        {
            var subscribeMessage = new SubscribeRequest()
            {
                Topic             = messageType.GetSimpleAssemblyQualifiedName(),
                SubscriberAddress = subscriberAddress,
            };
            Dictionary <String, String> headers = new Dictionary <string, string>();

            headers[Headers.Intent] = Headers.IntentOptions.PointToPoint;
            return(routingApi.Send(address, subscribeMessage, headers));
        }