com.poscoict.glueframework.scheduling.remote
Class GlueHttpJobEventSender

java.lang.Object
  extended by com.poscoict.glueframework.scheduling.remote.GlueHttpJobEventSender
All Implemented Interfaces:
GlueJobEventSender, InitializingBean

public class GlueHttpJobEventSender
extends Object
implements GlueJobEventSender, InitializingBean

GlueJobEventSender 구현체. 원격에 위치한 스케줄러 서버로 Job 기동 요청을 보내는 Http Sender 클래스.

 Bean Property
 
 - address : default java.net.InetAddress.getLocalHost().getHostAddress()
 
 - retryCount : default "2"
 
 - charset : default "EUC-KR"
 
 
 예제
 사용 예# 1
 
     <bean id="sender" class="com.poscoict.glueframework.scheduling.remote.GlueHttpJobEventSender"/>
 
 
 사용 예# 2
 
     <bean id="sender" class="com.poscoict.glueframework.scheduling.remote.GlueHttpJobEventSender">
         <property name="retryCount" value="2" />
     </bean>
 
 
 
 참고 : {pgm}-service.xml
 
     <?xml version="1.0" encoding="UTF-8"?>
     <service ...
         <activity name="FireJob" class="com.poscoict.glueframework.scheduling.activity.GlueJobCall">
             <transition name="success" value="end" />
             <property name="sender" value="eventSender" />
             ...
         </activity>
     </service>
 


Field Summary
protected static String HTTP_PREFIX
           
 
Constructor Summary
GlueHttpJobEventSender()
           
 
Method Summary
 void afterPropertiesSet()
           
 String getAddress()
           
 String getCharset()
           
 int getRetryCount()
           
protected  org.apache.commons.httpclient.NameValuePair[] makeRequestBody(GlueJobDefinition jobDef)
           
 String sendJobEvent(GlueJobDefinition jobDef)
          TargetUrl에 정의된 서버로 http request를 보낸다.
 String sendJobEvent(GlueJobDefinition jobDef, String targetUri)
          targetUrl에 정의된 서버로 http request를 보낸다.
 void setAddress(String address)
           
 void setCharset(String charset)
           
 void setRetryCount(int retryCount)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_PREFIX

protected static final String HTTP_PREFIX
See Also:
Constant Field Values
Constructor Detail

GlueHttpJobEventSender

public GlueHttpJobEventSender()
Method Detail

getAddress

public String getAddress()

setAddress

public void setAddress(String address)

getRetryCount

public int getRetryCount()

setRetryCount

public void setRetryCount(int retryCount)

sendJobEvent

public String sendJobEvent(GlueJobDefinition jobDef,
                           String targetUri)
Description copied from interface: GlueJobEventSender
targetUrl에 정의된 서버로 http request를 보낸다. JobDefinition 정보를 추출하여 request를 생성한다. 서버 스케줄러에서 정상적으로 접수가 되면 "success"가 리턴된다. (Scheduled Job이 정상적으로 처리된 것을 의미하는 것이 아니다.) /glue-scheduler 에 대해서는 고정값이다.

Specified by:
sendJobEvent in interface GlueJobEventSender
targetUri - : http://127.0.0.1:8805/glue-scheduler
Returns:
성공 시 "success"

sendJobEvent

public String sendJobEvent(GlueJobDefinition jobDef)
TargetUrl에 정의된 서버로 http request를 보낸다. JobDefinition 정보를 추출하여 request를 생성한다. 서버 스케줄러에서 정상적으로 접수가 되면 "success"가 리턴된다. (Scheduled Job이 정상적으로 처리된 것을 의미하는 것이 아니다.)

Specified by:
sendJobEvent in interface GlueJobEventSender
Parameters:
jobDef -
Returns:
성공 시 "success"
Throws:
GlueException - - Request 송신 실패 시

makeRequestBody

protected org.apache.commons.httpclient.NameValuePair[] makeRequestBody(GlueJobDefinition jobDef)

getCharset

public String getCharset()
Returns:
the charset

setCharset

public void setCharset(String charset)
Parameters:
charset - the charset to set

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception


Copyright © 2013–2016 POSCO ICT. All rights reserved.