This is a guide document that how you can setting up JMS Queue and JMX on JBoss AS 7.1.1.Final or EAP6. In EAP5, server port for JMS used 1099, but EAP6 doesn't use that port any longer. This also explains about JBoss JMX to monitor Java heap and JMX via MBean.
If you want to get more information or open source, please email
2. JMS Queue
Potential
Receiver 1
Sender
메시지 1
Potential
Receiver 2
메시지 2
Queue
메시지1
메시지2
- Point-to-Point 모델에서는 Sender에 의해 발생된 메시지가 Queue라는 채널에 전달되고, 이 메시지는
Queue에 의해 자동으로 Receiver에 전달
- Publisher/Subscriber 모델과 다른 점은 Queue에 전달된 하나의 메시지는 오직 하나의 Receiver에만 전달되
고 다수의 Receiver 에 전달되지 않음
- Sender에 의해 Queue에 전달된 메시지1은 Queue에 의해 Receiver1에 전달되고, Sender에 의해 전달된 메
시지2는 Queue에 의해 Receiver2에 전달
- Publisher/Subscriber 모델처럼 동일한 메시지가 서로 다른 Receiver에 전달되지 않음
- Internal Use Only -
3. JMS Topic
Subscriber
Publisher
메시지 1
메시지 2
Subscriber
메시지 1
메시지 2
Topic
메시지1
메시지2
- Publisher/Subscriber 모델에서는 Publisher가 하나의 메시지를 다수의 Subscriber(Consumer)에게
Topic 이라는 채널을 통하여 전달
- 모든 Subscriber는 Publisher가 Topic에 보낸 하나의 메시지의 사본을 전달 받게 되며, 이와 같은 메시
지 전달은 Topic에 의해 자동으로 Subscriber에 전달
- Publisher 에 의해 전달된 메시지1은 동시에 Subscriber1, Subscriber2 에 전달되며, Publisher에 의해
전달된 2번째 메시지인 메시지2 도 Subscriber1, Subscriber2에 전달
- Internal Use Only -
4. JBoss JMS 핵심 기능
JMS 1.1 스펙 준수 및 JBoss AS의 런타임 라이브러리로 사용.
성능, 신뢰성, 안정성 및 낮은 응답시간 등에 초점을 둠.
SOA의 초기 단계인 JBoss ESB의 핵심 모듈로서 사용
Netty 기반의 고성능 자바 엔진(LDAP, DNS, Keberos, etc)
Client-side Delegates
?
Connection
Sender
Session
JBoss
Netty
Core
Producer
Server-side
aspects
Consumer
Client-side aspects
Server-side
endpoints
- Internal Use Only -
Receiver
5. JBoss Netty – 고성능 네트워크 클라이언트/서버 프레임워크
이벤트 기반 비동기 네트워크 애플리케이션 프레임워크
Interceptor Chain 패턴
• 손쉽게 다단계 State machine 구현
• 암복호화 + 전문 해석 + 스레드 풀링 + 비즈니스 로직
• 조립 가능한 컴포넌트 다수 제공
과부하 및 DoS 방어 메커니즘
Old · New I/O 모두 지원
NIO 구현·벤더별 최적화
- Internal Use Only -
6. 부가 기능 및 성능
SpecJMS2007 Bench Mark
- 초당 820만건 데이터 처리
HTTP를 이용한 단순한 RESTful
인터페이스 제공
AMQP – 향후 AMQP 프로토콜 지원
예정
STOMP(Streaming Text Oriented
Messaging Protocol)
STOMP 메시지 브로커를 통해 다양한
이기종 언어 간의 메시지 통신 기능
지원
XMPP : XML 기반 인터넷 통신을 위한
오픈 프로토콜
비동기 웹 지원 (Ajax/comet/bayeaux)
http://hornetq.blogspot.kr/2011/07/82-million-messages-second-with-specjms.html
- Internal Use Only -
7. JMS Queue 생성
Naming이 java:jboss/exported/ 로 시작되지 않으면 글로벌 JNDI에 바인딩되지 않음
- Internal Use Only -
8. JMS 사용자 생성
JMS 접근 사용자 생성
C:Javajboss-eap-6.1bin>add-user.bat
JAVA_HOME is not set. Unexpected results may occur.
Set JAVA_HOME to the directory of your local JDK to avoid this message.
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): b
Enter the details of the new user to add.
Realm (ApplicationRealm) :
Username (testuser) : ienvyou
Password : !test123
Re-enter Password : !test123
What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for
none)[ ]: testrole
About to add user 'ienvyou' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'ienvyou' to file 'C:Javajboss-eap-6.1standaloneconfigurationapplication-users.properties'
Added user 'ienvyou' to file 'C:Javajboss-eap-6.1domainconfigurationapplication-users.properties'
Added user 'ienvyou' with roles testrole to file 'C:Javajboss-eap6.1standaloneconfigurationapplication-roles.properties'
Added user 'ienvyou' with roles testrole to file 'C:Javajboss-eap-6.1domainconfigurationapplicationroles.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server
EJB calls.
yes/no?
- Internal Use Only -
10. 애플리케이션을 통한 테스트
try {
Hashtable<String, String> properties = new Hashtable<String, String>();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "remote://localhost:4447");
properties.put(Context.SECURITY_PRINCIPAL, "admin");
properties.put(Context.SECURITY_CREDENTIALS, "!test123");
Context ctx = new InitialContext(properties);
ConnectionFactory cf = (ConnectionFactory) ic.lookup("jms/RemoteConnectionFactory");
Queue queue = (Queue) ic.lookup(destinationName);
System.out.println("Queue " + destinationName + " exists");
Connection connection = cf.createConnection("ienvyou", "!test123");
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer sender = session.createProducer(queue);
sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
TextMessage message = session.createTextMessage("Hello!");
sender.send(message);
System.out.println("The message was successfully sent to the " + queue.getQueueName() + " queue");
connection.start();
} catch(Exception e) {
}
closeConnection(connection);
- Internal Use Only -
11. Before JMX
Before JMX
벤더 고유의 관리 콘솔을 제공
일반적으로 웹 브라우저를 통하여 접근하도록 설계
API를 제공해주지 않을 경우 해당 관리 객체에 접근하기 어려움
Firewall hardware
Management console
Server
Management console
Web server software
Management console
Server Application
Management console
DB server software
Management console
- Internal Use Only -
12. With JMX(Java Management Extension)
JMX를 이용할 경우 소프트웨어 관리 포인트를 한 곳으로 집중할 수 있다는 장점이 발생.(JSR-255)
• 모든 리소스는 MBean을 사용하여 관리.
• JMX Agent (or group of agents)상의 모든 MBean은 하나의 관리 콘솔에서 모두 처리
Firewall hardware
Server
JMX Agent
Web server software
Server Application
DB server software
Adapter
Management console
= JMX MBean
http://www.jcp.org/en/jsr/detail?id=255
JSR 255: JavaTM Management Extensions (JMXTM) Specification, version 2.0
- Internal Use Only -
13. WebLogic JMX 적용 예
DomainRuntimeMBean을 통한 현재 JVM 및 JMS 상태 정보
JMS 관련 Queue 설정 정보 확인
-----------------------------------------------------------------------------------------------------------------com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean
ServerRuntimes
-----------------------------------------------------------------------------------------------------------------Server Name
Server State
Server JVMRuntime Name
Server JVMRuntime HeapSizeCurrent
Server JVMRuntime HeapFreeCurrent
Server JMSRuntime JMSServers Name
Server JMSRuntime JMSServers Destinations Name
Server JMSRuntime JMSServers Destinations ConsumersCurrentCount
Server JMSRuntime JMSServers Destinations ConsumersHighCount
Server JMSRuntime JMSServers Destinations ConsumersTotalCount
Server JMSRuntime JMSServers Destinations MessagesCurrentCount
Server JMSRuntime JMSServers Destinations MessagesHighCount
Server JMSRuntime JMSServers Destinations MessagesPendingCount
Server JMSRuntime JMSServers Destinations MessagesReceivedCount
-----------------------------------------------------------------------------------------------------------------com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean
DomainConfiguration
-----------------------------------------------------------------------------------------------------------------Domain JMSSystemResources JMSResource Name
Domain JMSSystemResources JMSResource Queues Name
Domain JMSSystemResources JMSResource Queues JNDIName
Domain JMSSystemResources JMSResource DistributedQueues Name
Domain JMSSystemResources JMSResource DistributedQueues JNDIName
Domain JMSSystemResources JMSResource DistributedQueues DistributedQueueMembers Name
- Internal Use Only -
14. JMX Object Name 수집
C:Javajboss-eap-6.1bin> standalone.bat -c standalone-full
C:Javajboss-eap-6.1bin> jconsole.bat
- Internal Use Only -