コード例 #1
0
        protected QpidTemplate InitializeAndCreateTemplate()
        {
            string host = "localhost";
            int port = 5672;
            ConnectionParameters parameters = new ConnectionParameters(host, port, "dev-only", "guest", "guest");
            
            clientFactory = new SimpleClientFactory(parameters);


            QpidTemplate template = new QpidTemplate();
            template.ClientFactory = clientFactory;
            template.ChannelTransacted = true;
            template.AfterPropertiesSet();

            //Declare queue and bind to a specific exchange.
            template.Execute<object>(delegate(IClientSession session)
                                         {
                                             session.QueueDeclare(TestConstants.QUEUE_NAME);
                                             //TODO Bind XSD needs to take into accout parameters nowait and 'Dictionary' args
                                             session.ExchangeBind("message_queue", "amq.direct", "routing_key");
                                             //model.QueueBind(TestConstants.QUEUE_NAME, TestConstants.EXCHANGE_NAME, TestConstants.ROUTING_KEY, false, null);
                                             return null;
                                         });
            return template;
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public SimpleClientFactory(ConnectionParameters connectionParameters)
 {
     this.connectionParameters = connectionParameters;
 }