.net - No IConnectionFactory implementation found for connection URI: activemq:tcp: -
i still "no iconnectionfactory implementation found connection uri: activemq:tcp://localhost:61616" error. i've paste , include in compile project archive "nmsprovider-activemq.config" i'm working .net 4.0 , references apache.nms-1.5.1-bin.zip\net-4.0\release
the code estandar , simple can't throw connection error
using system; using system.collections.generic; using system.linq; using system.text; using apache.nms; using apache.nms.util; using system.collections; using system.reflection; using system.io; namespace conexionactivemq { class program { private static string[] getconfigsearchpaths() { arraylist pathlist = new arraylist(); // check current folder first. pathlist.add(""); appdomain currentdomain = appdomain.currentdomain; // check folder assembly located in. pathlist.add(path.getdirectoryname(assembly.getexecutingassembly().location)); if (null != currentdomain.basedirectory) { pathlist.add(currentdomain.basedirectory); } if (null != currentdomain.relativesearchpath) { pathlist.add(currentdomain.relativesearchpath); } return (string[])pathlist.toarray(typeof(string)); } static void main(string[] args) { string[] direcciones; direcciones = getconfigsearchpaths(); // example connection strings: // activemq:tcp://localhost:61616 // stomp:tcp://activemqhost:61613 // ems:tcp://tibcohost:7222 // msmq://localhost uri connecturi = new uri("activemq:tcp://localhost:61616"); console.writeline("about connect " + connecturi); // note: ensure nmsprovider-activemq.config file exists in executable folder. iconnectionfactory factory = new nmsconnectionfactory(connecturi); using (iconnection connection = factory.createconnection()) using (isession session = connection.createsession()) { // examples getting destination: // // hard coded destinations: // idestination destination = session.getqueue("foo.bar"); // debug.assert(destination iqueue); // idestination destination = session.gettopic("foo.bar"); // debug.assert(destination itopic); // // embedded destination type in name: // idestination destination = sessionutil.getdestination(session, "queue://foo.bar"); // debug.assert(destination iqueue); // idestination destination = sessionutil.getdestination(session, "topic://foo.bar"); // debug.assert(destination itopic); // // defaults queue if type not specified: // idestination destination = sessionutil.getdestination(session, "foo.bar"); // debug.assert(destination iqueue); // // .net 3.5 supports extension methods simplified syntax: // idestination destination = session.getdestination("queue://foo.bar"); // debug.assert(destination iqueue); // idestination destination = session.getdestination("topic://foo.bar"); // debug.assert(destination itopic); idestination destination = sessionutil.getdestination(session, "queue://foo.bar"); console.writeline("using destination: " + destination); // create consumer , producer using (imessageconsumer consumer = session.createconsumer(destination)) using (imessageproducer producer = session.createproducer(destination)) { // start connection messages processed. connection.start(); //producer.persisten = true; // send message itextmessage request = session.createtextmessage("hello world!"); request.nmscorrelationid = "abc"; request.properties["nmsxgroupid"] = "cheese"; request.properties["myheader"] = "cheddar"; producer.send(request); // consume message itextmessage message = consumer.receive() itextmessage; if (message == null) { console.writeline("no message received!"); } else { console.writeline("received message id: " + message.nmsmessageid); console.writeline("received message text: " + message.text); } } } } } }
you need activemq version of nms libs.
Comments
Post a Comment