Site Search :
Standard Enterprise XML Methodology Pattern Setting Tunning Other
Article Contributors
GuestBook
Javapattern Maven
XSourceGen Dev
JetSpeed Test
JLook Image
jLook Family Site


Weblogic 7¿¡¼­ JMS Queue Browser È°¿ë 1
 
º» ¾ÆƼŬÀº JMS¿Í °ü·ÃÇÏ¿© Queue¿¡ ÀÖ´Â ¸Þ½ÃÁö¸¦ Á¶È¸ÇÏ°í °Ë»öÇÏ¿© Àç󸮵îÀÇ ÀÛ¾÷À» ¼öÇàÇÏ°í ÇÏ´Â ÇÁ·ÎÁ§Æ®ÀÇ ÇÊ¿ä¿¡ ÀÇÇØ ¸¸µé¾îÁø °ÍÀÌ´Ù. ( 2003/08/12 ) 174
Written by mino - ±è¹ÎÈ£
1 of 1
 

À̹ø ¾ÆƼŬÀº JLook¸â¹öÀ̽Š±è¹ÎÈ£´Ô²²¼­ ¿Ã¸®½Ã´Â ±ÛÀÔ´Ï´Ù. Contributor·ÎÀÇ µîÀ縦 
¾à¼ÓÇϼÌÀ¸´Ï »ó´çÈ÷ °í±ÞÀÚ·á°¡ ¿Ã¶ó¿À¸®¶ó »ý°¢µË´Ï´Ù. °¨»çÇÕ´Ï´Ù.

ÀÚ..½ÃÀÛÇÔ´Ù.


º» ¾ÆƼŬÀº JMS¿Í °ü·ÃÇÏ¿© Queue¿¡ ÀÖ´Â ¸Þ½ÃÁö¸¦ Á¶È¸ÇÏ°í °Ë»öÇÏ¿© Àç󸮵îÀÇ ÀÛ¾÷À» ¼öÇàÇÏ°í ÇÏ´Â ÇÁ·ÎÁ§Æ®ÀÇ ÇÊ¿ä¿¡ ÀÇÇØ ÇöÀç °³¹ßÁßÀÎ ÇÊÀÚ°¡ ³î»õ´ÔÀÇ ¾ÆƼŬ¿¡ ´ëÇÑ ¾Ð¹Ú°ú ³ªµµ ÇÔ ½áºÁ¾ß°Ú´Ù´Â ¸¶À½¿¡¼­ ¾²°ÔµÈ ¾ÆƼŬÀÓÀ» ¹àÈ÷´Â ¹ÙÀÌ´Ù. ¢º Áغñ»çÇ× ÀÏ´Ü Weblogic¸¦ ±ò¾Æ¾ß Çϴµ¥, ¹öÀüÀº Å©°Ô »ó°ü¾øÀ½. ´ëºÎºÐ javax.jms ÀÇ extended packageºÎºÐ¸¸À» »ç¿ëÇϱ⠶§¹®¿¡¡¦ ´Ü. À¥·ÎÁ÷ÀÌ¿©¾ß ÇÒ°É. ¢º QueueBrowser ÇöÀç ÇÊÀÚ°¡ ÁøÇàÇÏ´Â ÇÁ·ÎÁ§Æ®¿¡¼­ ¿ÜºÎ client¿¡ ´ëÇÑ ¿äûÀ» JMS Queue°¡ ¹Þ°í ±× QueueÀÇ ³»¿ëÀ» WLIÀÇ BPMÀÌ Ã³¸®ÇÏ´Â ±¸Á¶·Î µÇ¾î Àִµ¥, (BPMÀÌ ¹ºÁö´Â ÀÌ ¾ÆƼŬ¿¡¼± ¸ô¶óµµ µÈ´Ù.) °í°´ÃøÀÇ ¿äûÀ¸·Î ÀÎÇÏ¿© Queue¿¡ °üÇÑ ¸ð´ÏÅ͸µ°ú ÇâÈÄ Error Handling¿¡ »ç¿ëÇϱâ À§Çؼ­ QueueBrowser¸¦ »ç¿ëÇÏ¿© ¿øÇÏ´Â QueueÀÇ ³»¿ëÀ» Á¶È¸Çϴµ¥ »ç¿ëµÇ´Â Ŭ·¡½ºÀÌ´Ù. ÀÏ´Ü QueueBrowser´Â ´ÙÀ½°ú °°Àº ÇüÅ·Π¾ò¾î³¾ ¼ö ÀÖ´Ù.

public static void messageList(
	String connectionFactoryName,
	String queueName)
	throws Exception {

	// QueueConnectionFactory¸¦ ¸¸µç´Ù.
	QueueConnectionFactory queueConnectionFactory =
		NamespaceUtil.getQueueConnectionFactory(
			prop.getProperty("wli.server.url"),
			prop.getProperty("wli.server.user"),
			prop.getProperty("wli.server.password"),
			connectionFactoryName);

	// QueueConnectionFactory·Î ºÎÅÍ QueueConnectionÀ» ¾ò¾î¿Â´Ù.
	QueueConnection queueConnection =
		queueConnectionFactory.createQueueConnection();
	queueConnection.start();

	// QueueConnectionÀ¸·ÎºÎÅÍ QueueSessionÀ» »ý¼ºÇÑ´Ù.
	QueueSession queueSession = null;
	queueSession =
queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

	Queue queue =
		NamespaceUtil.getQueue(
			prop.getProperty("wli.server.url"),
			prop.getProperty("wli.server.user"),
			prop.getProperty("wli.server.password"),
			queueName);
		
	QueueSender queueSender = queueSession.createSender(queue);
	QueueReceiver queueReciever = 
queueSession.createReceiver(queue);

	TextMessage sendTextMessage = null;
	sendTextMessage = queueSession.createTextMessage();
	sendTextMessage.setText("TestÀÔ´Ï´Ù....1");

	queueSender.send(sendTextMessage);

	QueueBrowser queueBrowser = queueSession.createBrowser(queue);
		
	Enumeration enum = queueBrowser.getEnumeration();
	TextMessage textMessage = null;
	System.out.println("Browser Start!");
	while(enum.hasMoreElements()){
		textMessage = (TextMessage)enum.nextElement();
		System.out.println(textMessage.getJMSMessageID() + 
" [ " + textMessage.getText() +" ]");
	}
	System.out.println("Browser End!");
		
	TextMessage recieveTextMessage = null;
	recieveTextMessage = (TextMessage) queueReciever.receive();
		
	System.out.println("recieveTextMessage ==> " + 
recieveTextMessage);
	queueBrowser.close();
}

À§¿¡¼­ NamespaceUtil Class ¿Í prop´Â ÇÊÀÚ°¡ ÇÊ¿ä¿¡ ÀÇÇؼ­ »ç¿ëÇÑ Utility classÀε¥, ¿ëµµ´Â ´ÙÀ½°ú °°´Ù. NamespaceUtil : ÁÖ·Î JNDI LookupÀ» ÇÏ´Â ³ðµéÀ» ¹Ì¸® ¾ò¾î³»±â À§ÇÑ Utility class PropManager : ¼­¹öÀÇ Á¤º¸µîÀ» Properties·Î °ü¸®ÇÏ´Â Utility class µû¶ó¼­ À§ÀÇ Å¬·¡½º´Â ±×³É Àú·±³ðÀÌ ÀÖ´Ù°í¸¸ ¾Ë°í ´ÙÀ½À¸·Î ³Ñ¾î°¡ÀÚ. À§ÀÇ ¼Ò½º¸¦ º¸¸é ´ëÃæ¾Ë°ÚÁö¸¸, º¸Åë Queue¿¡ Message¸¦ ³Ö¾ó¶§³ª, »¬¶§ÀÇ ÄÚµù°ú º°¹Ý ´Ù¸£Áö ¾Ê´Ù. ´Ù¸¸ QueueSession¿¡¼­ ¾ò¾î³½ QueueBrowser°°Àº °æ¿ì ´ÜÁö Á¶È¸¸¸ Çϴ°ÍÀÌÁö ´Ù¸¥ÀÛ¾÷(»©³½´Ù°Å³ª ³Ö´Â´Ù°Å³ª)Àº ÇÒ ¼ö ¾øÀ½Àº ¾Ë¾ÆµÎÀÚ. ÀÏ´Ü À§¿Í °°Àº ÄÚµùÀ¸·Î ÀÛ¾÷À» ¼öÇàÇÏ°Ô µÇ¸é ¿øÇÏ´Â Queue¿¡ ´ëÇؼ­ º¼ ¼ö ÀÖ´À³Ä, °í°Ç ¾Æ´Ï´Ù. ¿Ö³Ä¸é, WeblogicÀÇ °æ¿ì ¸ðµç Resource¸¦ ACL·Î °ü¸®¸¦ Çϱ⠶§¹®¿¡ JMS¿¡ ´ëÇÑ Browser±ÇÇÑÀÌ ¾ø´Ù¸é º¼¼ö ¾ø´Ù´Â ¿¡·¯°¡ ¶ß´Â°ÍÀÌ´Ù. µû¶ó¼­ Weblogic console¿¡ µé¾î°¡ JMSÀÇ ´ëÇÑ Browser±ÇÇÑÀ» Áà¾ß ÇÑ´Ù. [domain name] > Realms> myRealm> Access Control L... ·Î µé¾î°¡¸é À§¿Í °°Àº È­¸éÀ» º¼ ¼ö Àִµ¥ ÀÌ°ÍÀÌ Nameº° PermissionÀ» ÁÙ ¼ö ÀÖ´Â °÷ÀÌ µÇ°Ú´Ù. ÀÌ°÷¿¡¼­ ´ÙÀ½°ú °°Àº °÷À» ã¾Æ¼­ browser¸¦ Ãß°¡ÇÏ¸é µÈ´Ù. À§¸¦ º¸¸é weblogic.jms¿¡ browse¶ó´Â°Ô º¸À̴µ¥ ÀÌ°Ô ¿ø·¡ ÇÊÀÚÀÇ weblogic(Á¤È®È÷ ¸»Çϸé Çö ÇÁ·ÎÁ§Æ®ÀÇ °³¹ß¼­¹ö)¿¡´Â ¾ø¾ú´Ù. ¾Æ¸¶µµ À̱ÛÀ» ÀÐÀ¸½Ã´Â ºÐµé¶ÇÇÑ ¾øÀ» ÅÍÀÌ´Ï ³Ö¾îÁֱ⸸ ÇÏ¸é µÈ´Ù. ±×³É browse¶ó´Â À̸§À¸·Î À§ÀÇ ¼Ò½º¿¡¼­ weblogicÀ» connecteÇÒ¶§ »ç¿ëÇÒ user ¶Ç´Â GroupÀÇ À̸§À» ³Ö¾îÁÖ¸é µÈ´Ù. - ÀÌÁ¡ÀÌ Áß¿äÇÑ °ÍÀÌ µÇ°Ú´Ù. ÀÌ·¸°Ô ÇÏ¸é ´ÙÀ½°ú °°ÀÌ Queue¿¡ ÀÖ´Â Message¸¦ º¼ ¼ö ÀÖ°Ô µÈ´Ù. ÀÌ»ó ù¹ø° ¾ÆƼŬÀ» ¸¶Ä¡·Á ÇÑ´Ù. 4³âÀüÀΰ¡ ¸ð »çÀÌÆ®¿¡¼­ ÀÚ¹Ù ¾ÆƼŬÀ» ¸î °³¿ù¿¡ °ÉÃÄ ½è´øÀûÀÌ ÀÖ¾ú´ø °Í °°´Ù. Á¤¸»ÀÌÁö Èûµé¾ú´Âµ¥. ±×³ª¸¶ ³î»õ´ÔÀÇ »çÀÌÆ®¿¡ ¾ñÇô¼­ ³» ¸¶À½ ³»Å°´Âµ¥·Î ÇÑ´Þ¿¡ ÇѹøÀÌµç µÎ¹øÀÌµç ³»¸¾´ë·ç ¾µ¼ö ÀÖ´Ù´Â °ÍÀÌ ¾ó¸¶³ª ¸¶À½¿¡ µå´ÂÁö.. ¤»¤» »ç½Ç ÀÌ ¾ÆƼŬÀ» ¾µ´ë Á¸´ñ¸»·Î ½á¾ß Çϳª ¹Ý¸»·Î ½á¾ßÇϳª ¹«Ã´À̳ª ¸Á¼³¿´´Âµ¥, ÀÏ´Ü ³î»õ´ÔÀÌ ¹Ý¸»·Î ¾²°í, ¹º°¡¸¦ °¡¸£Ä¡°Å³ª ¾ÆƼŬÀ» ¾µ¶§´Â ±×³É ÆíÇÑ°Ô ÁÁ´Ù°í »ý°¢ÇÑ´Ù. ±×·¡¼­ ÀÌ·¸°Ô ÇÑ°ÍÀ̴ϱñ ¾î¸°³ðÀÌ ¹Ý¸»ÇÑ´Ù°í ¸¶À½¼Ó¿¡ Ç°Áú¸»°í ±×³É Àؾî¹ö¸®±â ¹Ù¶õ´Ù. ±×·³ 20000
 
1
References
 
Copyright ¨Ï 2003 www.javapattern.info & www.jlook.com, an jLOOK co.,LTD