kr.co.hit.live.jms
Class BaseMessageProducer

java.lang.Object
  extended by kr.co.hit.live.jms.BaseMessageProducer
Direct Known Subclasses:
QueueMessageSender, TopicMessagePublisher

public class BaseMessageProducer
extends Object

JMS에서 Queue와 Topic 방식으로 전달되는 메세지의 헤더 정보를 관리하기 위한 클래스.

Since:
3.0
Version:
$Revision: 1.1 $ $Date: 2006/09/26 08:20:09 $
Author:
홍선주(현대정보기술)

Field Summary
protected  javax.jms.Connection connection
           
protected  javax.jms.ConnectionFactory connectionFactory
           
protected  String DEFAULT_MESSAGE_KEY
           
protected  String DEFAULT_MESSAGE_KEY_VALUE
           
protected  javax.jms.Destination destination
           
protected  String DESTINATION_TYPE_QUEUE
           
protected  String DESTINATION_TYPE_TOPIC
           
protected  javax.jms.MapMessage message
           
protected  javax.jms.MessageProducer producer
           
protected  javax.jms.Session session
           
 
Constructor Summary
BaseMessageProducer()
           
 
Method Summary
 void commitSession()
           현재 세션을 커밋한다.
protected  void createMessageHeader(String msgType)
           Live JMS Client와의 규약대로 메시지의 헤더 정보를 설정한다.
protected  javax.jms.Destination getDestination()
           현재 Message Producer에 대한 데스티네이션을 얻는다.
protected  String getDestinationType()
           데스티네이션 타입을 얻는다.
protected  String getJmsEngine()
           JMS 엔진 이름을 얻는다.
 void releaseResource()
           메세지 전송 후 리소스를 해지한다.
 void rollbackSession()
           현재 세션을 롤백한다.
protected  void setDestination(javax.jms.Destination dest)
           데스티네이션을 설정한다.
protected  void setDestinationType(String destType)
           데스티네이션 타입을 정의한다.
protected  void setJmsEngine(String jmsEngine)
           JMS 엔진 이름을 설정한다.
 void setMessage(String msgKey, String msg)
           텍스트 메세지를 전송한다.
 void setMessageType(String msgType)
           메세지의 타입 및 모든 메시지에 공통적으로 정의되어야 하는 정보들을 지정한다.
 void startConnection()
           initResource()에서 초기화된 정보들을 기반으로 커넥션을 수행한다.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connectionFactory

protected javax.jms.ConnectionFactory connectionFactory

connection

protected javax.jms.Connection connection

session

protected javax.jms.Session session

producer

protected javax.jms.MessageProducer producer

destination

protected javax.jms.Destination destination

message

protected javax.jms.MapMessage message

DESTINATION_TYPE_QUEUE

protected final String DESTINATION_TYPE_QUEUE
See Also:
Constant Field Values

DESTINATION_TYPE_TOPIC

protected final String DESTINATION_TYPE_TOPIC
See Also:
Constant Field Values

DEFAULT_MESSAGE_KEY_VALUE

protected final String DEFAULT_MESSAGE_KEY_VALUE
See Also:
Constant Field Values

DEFAULT_MESSAGE_KEY

protected final String DEFAULT_MESSAGE_KEY
See Also:
Constant Field Values
Constructor Detail

BaseMessageProducer

public BaseMessageProducer()
Method Detail

startConnection

public void startConnection()
                     throws LiveException

initResource()에서 초기화된 정보들을 기반으로 커넥션을 수행한다.

Throws:
LiveException

releaseResource

public void releaseResource()
                     throws LiveException

메세지 전송 후 리소스를 해지한다.

Throws:
LiveException

setMessageType

public void setMessageType(String msgType)
                    throws LiveException

메세지의 타입 및 모든 메시지에 공통적으로 정의되어야 하는 정보들을 지정한다.

Parameters:
msgType - 문자열 형태의 메시지 타입(Print or alert)
Throws:
LiveException - 메시지 생성에 오류가 발생하는 경우

setMessage

public void setMessage(String msgKey,
                       String msg)
                throws LiveException

텍스트 메세지를 전송한다.

Parameters:
msg - 전송될 메세지
Throws:
LiveException

createMessageHeader

protected void createMessageHeader(String msgType)
                            throws LiveException

Live JMS Client와의 규약대로 메시지의 헤더 정보를 설정한다.

Parameters:
msgType - 메시지의 타입(PRINT or ALERT)
Throws:
LiveException - 메시지의 헤더정보 설정시 에러가 발생하는 경우

commitSession

public void commitSession()
                   throws LiveException

현재 세션을 커밋한다. J2EE환경에서 컨테이너가 관리하는 트랜잭션이 아닌 일반 트랜잭션에서 동작하는 경우에는 반드시 커밋을 해주어야 한다. 커밋하는 시점에 모든 메시지가 전송된다.

Throws:
LiveException - 세션 커밋시에 에러가 발생하는 경우

rollbackSession

public void rollbackSession()
                     throws LiveException

현재 세션을 롤백한다.

Throws:
LiveException - 세션 롤백시 에러가 발생한 경우.

setDestination

protected void setDestination(javax.jms.Destination dest)

데스티네이션을 설정한다. 데스티네이션의 종류에는 Queue와 Topic 두가지가 있다.

Parameters:
dest - 데스티네이션명

getDestination

protected javax.jms.Destination getDestination()

현재 Message Producer에 대한 데스티네이션을 얻는다.

Returns:
데스티네이션

setDestinationType

protected void setDestinationType(String destType)

데스티네이션 타입을 정의한다.

Parameters:
destType - 데스티네이션 타입

getDestinationType

protected String getDestinationType()

데스티네이션 타입을 얻는다.

Returns:

setJmsEngine

protected void setJmsEngine(String jmsEngine)

JMS 엔진 이름을 설정한다.

Parameters:
jmsEngine - JMS 엔진이름으로 live-config.properties 파일로부터 얻어서 설정한다.

getJmsEngine

protected String getJmsEngine()

JMS 엔진 이름을 얻는다.

Returns:
JMS 엔진 이름


Copyright © 2014. All Rights Reserved.