'MQ'에 해당되는 글 2

  1. 2015.06.12 ActiveMQ
  2. 2010.07.11 외부 연계 테스트

ActiveMQ

오픈소스 메시징/통합패턴 서버

다양한 언어 지원
STOMP, AMQP, MQTT
JMS 1.1 and J2EE 1.4


- 2015-06-12 현재 apache-activemq-5.11.1가 최신

그런데 실행이 안됨. 에러도 발생 안함.

apache-activemq-5.11.1> bin\activemq
Java Runtime: Oracle Corporation 1.7.0_09 C:\Program Files\Java\jdk1.7.0_09\jre
  Heap sizes: current=1013632k  free=996854k  max=1013632k
    JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G ...

Extensions classpath:
  [...]
ACTIVEMQ_HOME: ...\apache-activemq-5.11.1\bin\..
ACTIVEMQ_BASE: ...\apache-activemq-5.11.1\bin\..
ACTIVEMQ_CONF: ...\apache-activemq-5.11.1\bin\..\conf
ACTIVEMQ_DATA: ...\apache-activemq-5.11.1\bin\..\data
Usage: Main [--extdir <dir>] [task] [task-options] [task data]

Tasks:
    browse                   - Display selected messages in a specified destination.
    bstat                    - Performs a predefined query that displays useful statistics regarding the specified broker
    create                   - Creates a runnable broker instance in the specified path.
    decrypt                  - Decrypts given text
    dstat                    - Performs a predefined query that displays useful tabular statistics regarding the specified destina
tion type
    encrypt                  - Encrypts given text
    export                   - Exports a stopped brokers data files to an archive file
    list                     - Lists all available brokers in the specified JMX context
    purge                    - Delete selected destination's messages that matches the message selector
    query                    - Display selected broker component's attributes and statistics.
    start                    - Creates and starts a broker using a configuration file, or a broker URI.
    stop                     - Stops a running broker specified by the broker name.

Task Options (Options specific to each task):
    --extdir <dir>  - Add the jar files in the directory to the classpath.
    --version       - Display the version information.
    -h,-?,--help    - Display this help information. To display task specific help, use Main [task] -h,-?,--help

Task Data:
    - Information needed by each specific task.

JMX system property options:
    -Dactivemq.jmx.url=<jmx service uri> (default is: 'service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi')
    -Dactivemq.jmx.user=<user name>
    -Dactivemq.jmx.password=<password>


확인 결과 5.10.0부터 발생

5.9.1은 제대로 실행됨.

apache-activemq-5.9.1> bin\activemq
Java Runtime: Oracle Corporation 1.7.0_09 C:\Program Files\Java\jdk1.7.0_09\jre
  Heap sizes: current=1013632k  free=996854k  max=1013632k
    JVM args: -Dcom.sun.management.jmxremote -Xms1G -Xmx1G ...
Extensions classpath:
  [...]
ACTIVEMQ_HOME: ...\apache-activemq-5.9.1\bin\..
ACTIVEMQ_BASE: ...\apache-activemq-5.9.1\bin\..
ACTIVEMQ_CONF: ...\apache-activemq-5.9.1\bin\..\conf
ACTIVEMQ_DATA: ...\apache-activemq-5.9.1\bin\..\data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@e34a3c: startup date [Fri Jun 12 22:51:42 KST 2015]; root of con
text hierarchy
 INFO | PListStore:[...\apache-activemq-5.9.1\bin\..\data\localhost\tmp_storage] started
 INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[...\apache-activemq-5.9.1\bin\.
.\data\kahadb]
 INFO | Apache ActiveMQ 5.9.1 (localhost, ID:pantarei-PC-20301-1434117106014-0:1) is starting
 INFO | Listening for connections at: tcp://...:61616?maximumConnections=...
 INFO | Connector openwire started
 INFO | Listening for connections at: amqp://...:5672?maximumConnections=...
 INFO | Connector amqp started
 INFO | Listening for connections at: stomp://...:61613?maximumConnections=...
 INFO | Connector stomp started
 INFO | Listening for connections at: mqtt://...:1883?maximumConnections=...
 INFO | Connector mqtt started
 INFO | Listening for connections at ws://...:61614?maximumConnections=...
 INFO | Connector ws started
 INFO | Apache ActiveMQ 5.9.1 (localhost, ID:...-20301-1434117106014-0:1) started
 INFO | For help or more information please see: http://activemq.apache.org
 WARN | Store limit is 102400 mb (current store usage is 0 mb). The data directory: ...\apa
che-activemq-5.9.1\bin\..\data\kahadb only has 31427 mb of usable space - resetting to maximum available disk space: 31427 mb
ERROR | Temporary Store limit is 51200 mb, whilst the temporary data directory: ...\apache-
activemq-5.9.1\bin\..\data\localhost\tmp_storage only has 31427 mb of usable space - resetting to maximum available 31427 mb.
 INFO | ActiveMQ WebConsole available at http://localhost:8161/
 INFO | Initializing Spring FrameworkServlet 'dispatcher'
 INFO | jolokia-agent: No access restrictor found at classpath:/jolokia-access.xml, access to all MBeans is allowed


http://localhost:8161/


- 데모

http://activemq.apache.org/web-samples.html

apache-activemq-5.9.1> bin\activemq xbean:examples/conf/activemq-demo.xml


http://localhost:8161/demo



외부 연계 테스트

상대방이 고객사로 들어오지 않아서 메신저와 전화를 통해서 테스트를 함.

EAI에 물려 있어서 테스트를 자동화하기가 힘듬.
고민해 볼 거리임.

테스트 준비가 잘 안되었다.
해당 시스템에 대한 정보도 없어서 하나씩 해보고 데이터베이스도 Sybase라 클라이언트 툴부터 설치했다.
테스트 준비로 오전을 보냄.

테스트를 시작하는데 갑자기 인터페이스가 달라진 것을 발견했다.
상대방에서 추가해 달라고 한 데이터가 제일 마지막에 붙는 것으로 알고 있었는데 앞부분에 붙어서 왔다.
인터페이스가 정해졌는데 지금와서 바꿔달라고 하는 거는 말이 안된다.
스펙대로 하자고 했다. 이거 순서바꾸는게 금방 하는거지만 서로 간의 약속인데 이렇게 바꾸면 안된다.

로그를 많이 남기지 않아서 버벅대네.
역시 WAS에 종속적이어서 로컬에서 테스트가 불가능하다 보니 테스트가 힘들다.

WebLogic을 내리고 올리는데 시간도 꽤 걸리고 쉘을 4번 실행시켜야 하는데 자동으로 될거 같은데.
앞의 쉘이 다 실행된 후에 다음 쉘 실행하기, 아니면 로그를 보고 있다가. 실행하면 되잖아.

MQ를 사용한 코드를 다 뜯어 고치고 싶은데 시간이 없어서 그러지를 못했다.
disconnect 부분과 commit만 수정했다.
이 두 부분은 예외가 발생하지도 않는데 try, catch로 감싸져 있다.
그냥 두려다 가독성이 떨어져서 도저히 안되겠다 싶어 리팩토링을 했다.

에러 발생시 보내는 전문이 지금까지 잘못 되어 있었다.
한글이 섞여서 2바이트로 계산되어야 하는 부분이 고려되어 있지 않았다.
이때까지 연계한 수많은 인터페이스는 뭐야?

상대방에서 원한 일련번호가 15자리인데 10자리는 숫자로 채워 오는데 나머지 5자리는 공백으로 들어온다.
이쪽 시스템에서는 trim 처리를 해서 10자리만 넘어온다.
응답시 이 일련번호를 그대로 넘겨줘야 하는데 5바이트가 모자랐다.
5자리 공백이 떨어져 나가서 그런거다.
응답시 5자리 공백을 더해 준다.(그냥 아무 생각없이)
나중에 15자리 숫자로 들어오면?
파싱할때 trim 처리를 하지 않고 받은 그대로 넘겨 주기로 한다.

1, 2 업무를 테스트한후 3번 업무를 하는데 우리 쪽에서 준비가 되어 있지 않았다.
준비가 소홀한 표시가 많이 난다. 음....

비동기식으로 MQ 통신시 commit 관련한 부분을 수정했다.

오랜만에 외부 테스트 했음.
짜증도 약간 냈지만 상대방이 괜찮은 사람이라...내가 인덕은 좀 있지. ㅎㅎㅎ
5시에 완료

- 총 소요 기간
  1. 회의(이동, 담당자 기다림, 회의는 1시간도 안했음)
  2. 소스 받고 간단한 설명 들음
  3. 팀원에게 소스 분석 시킴, 수정할 곳을 체크해 두라고 함. 그걸 보고 내가 조금 다듬었다.(거의 날로 먹는군)
  4. 운영자에게 소스 전달, 테스트 일정 잡음.
  5. 테스트...준비로 오전 소비, 처음 보는 시스템에 적응(의외로 빨리 적응한게 도움이 됨), 응답시 원인 모를 에러로 지체됨.
  6. 하루 더 테스트를 함.
총 5일 정도 소요됨.