/// <summary> /// Creates new Messaging Queue Server /// </summary> public MqServer(MqServerOptions options, IClientAuthenticator authenticator = null, IClientAuthorization authorization = null) { Options = options ?? new MqServerOptions(); Authenticator = authenticator; Authorization = authorization; _channels = new SafeList <Channel>(256); _clients = new SafeList <MqClient>(2048); InitInstances(); }
/// <summary> /// Creates new Messaging Queue Server /// </summary> public MqServer(MqServerOptions options, IClientAuthenticator authenticator = null, IClientAuthorization authorization = null) { Options = options ?? new MqServerOptions(); Authenticator = authenticator; Authorization = authorization; _channels = new SafeList <Channel>(256); _clients = new SafeList <MqClient>(2048); NodeServer = new NodeServer(this); NodeServer.Initialize(); }
public void Initialize(int port) { Port = port; MqServerOptions mqOptions = new MqServerOptions(); mqOptions.AllowedQueues = new[] { MessageA.ContentType, MessageB.ContentType, MessageC.ContentType }; mqOptions.AllowMultipleQueues = true; mqOptions.AcknowledgeTimeout = TimeSpan.FromSeconds(90); mqOptions.MessageTimeout = TimeSpan.FromSeconds(12); Server = new MqServer(mqOptions); Server.SetDefaultChannelHandler(new TestChannelHandler(this), null); Server.SetDefaultDeliveryHandler(new TestDeliveryHandler(this)); Server.ClientHandler = new TestClientHandler(this); Server.AdminAuthorization = new TestAdminAuthorization(); Channel channel = Server.CreateChannel("ch-1"); channel.CreateQueue(MessageA.ContentType).Wait(); channel.CreateQueue(MessageC.ContentType).Wait(); Channel channel0 = Server.CreateChannel("ch-0"); channel0.CreateQueue(MessageA.ContentType).Wait(); Channel croute = Server.CreateChannel("ch-route"); croute.Options.Status = QueueStatus.Route; croute.CreateQueue(MessageA.ContentType).Wait(); Channel cpush = Server.CreateChannel("ch-push"); cpush.Options.Status = QueueStatus.Push; cpush.CreateQueue(MessageA.ContentType).Wait(); Channel cpull = Server.CreateChannel("ch-pull"); cpull.Options.Status = QueueStatus.Pull; cpull.CreateQueue(MessageA.ContentType).Wait(); Channel cround = Server.CreateChannel("ch-round"); cround.Options.Status = QueueStatus.RoundRobin; cround.CreateQueue(MessageA.ContentType).Wait(); }