jms - Dummy TIBCO queue for testing -
jms - Dummy TIBCO queue for testing -
i have written piece of code connect tibco queue , fetch client data. cannot find way test before moving production. can create dummy queue somehow can ensure programme functional before packaging production?
here code..
bundle gi; import javax.jms.jmssecurityexception; import javax.naming.initialcontext; import javax.jms.queue; import javax.jms.textmessage; import javax.jms.queuesender; import javax.jms.deliverymode; import javax.jms.queuesession; import javax.jms.queueconnection; import javax.jms.queueconnectionfactory; import javax.jms.queuereceiver; public class queue { public queue() { system.err.println("\n------------------------------------------------------------------------"); system.err.println("tibjmstequeue sample"); system.err.println("------------------------------------------------------------------------"); } public string queueprocess(string xmlrequest, string serverurl, string username, string password, string inqueuename) { string [] args = new string[4]; args[0]=serverurl; args[1]=username; args[2]=password; args[3]=inqueuename; system.out.println("server....................... "+serverurl); system.out.println("user......................... "+username); system.out.println("inqueue...................... "+inqueuename); system.out.println("------------------------------------------------------------------------\n"); seek { tibjmsutilities.initsslparams(serverurl,args); } grab (jmssecurityexception e) { system.err.println("jmssecurityexception: "+e.getmessage()+", provider="+e.geterrorcode()); e.printstacktrace(); system.exit(0); } system.err.println("starting"); queueconnection connectionin = null; seek { initialcontext context = new initialcontext(); queue tibcoqueue = (queue) context.lookup("queue/queue0"); queueconnectionfactory mill = new com.tibco.tibjms.tibjmsqueueconnectionfactory(serverurl); connectionin = factory.createqueueconnection(username, password); queuesession sessionin = connectionin.createqueuesession(false,javax.jms.session.auto_acknowledge); queuesender queuesender = sessionin.createsender(tibcoqueue); queuesender.setdeliverymode(deliverymode.non_persistent); queuereceiver queuereceiver = sessionin.createreceiver(tibcoqueue); connectionin.start(); system.out.println("connected queue..."); system.out.println("xmlrequest: " + xmlrequest); textmessage sendxmlrequest = sessionin.createtextmessage(xmlrequest); queuesender.send(sendxmlrequest); system.out.println("sent: " + sendxmlrequest.gettext()); textmessage xmlresponse = (textmessage) queuereceiver.receive(); system.out.println("received: " + xmlresponse.gettext()); return((string) xmlresponse.gettext()); } catch(exception e) { system.err.println("exitting error"); e.printstacktrace(); system.exit(0); } { system.err.println("exitting"); seek {connectionin.close();} catch(exception e1) {} } return("failure"); } public static void main(string args[]) { queue t = new queue(); } }
it never suggested mix production , non-production traffic on same ems messaging instance. risky practice since introduces possibility of inadvertently sending non-production traffic production applications. suggest first checking ems operations team can point development ems instance can use.
for unit and/or integration testing not looking stress-test environment, many developers install instance of ems on local development workstation. 1 time again ems operations team may able provide license , installation binary install locally.
jms tibco-ems
Comments
Post a Comment