이 태스크 정보
프로그래밍 방식으로 시퀀스를 종료하여 단일 클라이언트가 한 번에 하나의 JVM에서 지원해야 하는 열린 시퀀스 수를 제한합니다.
신뢰할 수 있는 메시징 시퀀스에 대한 프로그램 제어를 확보하기 위한 클라이언트 애플리케이션의 경우, WSRMSequenceManager 인스턴스에 대한 액세스 권한이 필요합니다. . 다음 코드 단편을 사용하여 이를 수행하십시오.
import com.ibm.wsspi.wsrm.WSRMSequenceManager;
import com.ibm.wsspi.wsrm.WSRMSequenceManagerFactory;
.........
// Get the factory
WSRMSequenceManagerFactory factory = WSRMSequenceManagerFactory
.getInstance();
// Get the sequence manager instance
WSRMSequenceManager sequenceManager = factory.createWSRMSequenceManager();
모든
WSRMSequenceManager 메소드는
다음 매개변수를 사용합니다.
- 클라이언트 인스턴스 오브젝트. 이는 Dispatch client 인스턴스
또는 Dynamic proxy client입니다. 클라이언트 유형에 대한 세부사항은
JAX-WS
클라이언트 프로그래밍 모델 주제를 참조하십시오.
- 대상 엔드포인트의 Port QName 인스턴스.
WS-ReliableMessaging 시퀀스를 프로그래밍 방식으로
제어하려면 다음 단계에 설명된 대로
클라이언트 애플리케이션에 코드를 추가하십시오.
- 시퀀스를 작성할 코드를 추가하십시오.
사용 가능한 특성을 설정하려면 다음 메소드를 사용하십시오.
/**
* Sets the target provider endpoint.
* A null value will cause a NullPointerException when the WSRMSequenceProperties object is used.
*
* @param providerEndPoint The target service endpoint URI
*/
public void setTargetEndpointUri(String providerEndPoint);
/**
* This is used to indicate that a response flow is required between the provider and requester and the response
* flow will be established at create sequence time
*
* By calling this method it will indicate that a response flow is required.
*/
public void setUseOfferedSequenceId();
/**
* Set the Soap version for RM protocol messages.
* The default value for this property is WSRMSequenceProperties.SOAP_11
*
* @param soapVersion
*/
public void setSoapVersion(int soapVersion);
/**
* If the Sequence Acknowledgement messages are to be sent back asynchronously call this method.
*
*/
public void useAsyncTransport();
신뢰할 수 있는 메시징 시퀀스를 작성하려면 WSRMSequenceManager에서
createNewWSRMSequence 메소드를 사용하십시오.
/**
* Initiates a new sequence handshake between this client and the target EPR specified in the
* WSRMSequenceProperties instance.
*
* This sequence will only be valid for the client issuing the createNewWSRMSequence call.
*
* When returning from this call, there is no guarantee that the sequence has been established.
*
* @throws NullPointerException if the sequenceProperties object is null, or the target EPR is null
*
* @param clientObject The JAX-WS Dispatch instance, or the Dynamic Proxy client instance.
* @param sequencePropeties The properties for creating the reliable messaging sequence
* @throws WSRMNotEnabledException
* @throws WSRMSequenceAlreadyExistsException
*/
public void createNewWSRMSequence(Object clientObject, QName portQName, WSRMSequenceProperties sequencePropeties)
throws WSRMNotEnabledException,
WSRMSequenceAlreadyExistsException;
- 수신확인 요청을 전송할 코드를 추가하십시오.
WS-ReliableMessaging 시퀀스에 대한 수신확인 요청을 전송하려면
WSRMSequenceManager에서 다음 메소드를 사용하십시오.
/**
* Sending an acknowledgement request sends the ACK requested message to the specified target endPointUri.
* The target will respond with a range of messages that can be acknowledged for the current reliable messaging
* sequence.
*
* @param clientObject The JAX-WS Dispatch instance, or the Dynamic Proxy client instance.
* @param portQName
* @param endPointUri The target endpoint uri
* @throws WSRMNotEnabledException
* @throws WSRMSequenceUnknownException
* @throws WSRMSequenceTerminatedException
* @throws WSRMSequenceClosedException
*/
public void sendAcknowledgementRequest(Object clientObject, QName portQName, String endPointUri)
throws WSRMNotEnabledException,
WSRMSequenceUnknownException,
WSRMSequenceTerminatedException,
WSRMSequenceClosedException;
- 시퀀스를 닫을 코드를 추가하십시오.
WS-ReliableMessaging 시퀀스를 닫으려면
WSRMSequenceManager에서 다음 메소드를 사용하십시오.
/**
* Closes the web services reliable messaging session from this application to
* the endpoint url specified.
*
* Throws a WSRMSequenceTerminatedException if the session between this application
* and the target endpoint url is already closed
*
* Throws a WSRMSequenceTerminatedException when the session between this application
* and the target endpoint has already been terminated.
*
* Throws WSRMSequenceUnknownException exception when either reliable messaging is not engaged to
* the specified endpoint url or the sequence has previously been terminated and removed.
*
* @param clientObject The JAX-WS Dispatch instance, or the Dynamic Proxy client instance.
* @param endPointUri The target endpoint url
*
* @throws WSRMNotEnabledException
* @throws WSRMSequenceUnknownException
* @throws WSRMSequenceClosedException
* @throws WSRMSequenceTerminatedException
*/
public void closeSequence(Object clientObject, QName portQName, String endPointUri)
throws WSRMNotEnabledException,
WSRMSequenceUnknownException,
WSRMSequenceClosedException,
WSRMSequenceTerminatedException;
- 시퀀스를 종료할 코드를 추가하십시오.
WS-ReliableMessaging 시퀀스를 종료하려면
WSRMSequenceManager에서 다음 메소드를 사용하십시오.
/**
* Terminates web services reliable messaging session from this application to
* the endpoint url specified.
*
* Throws a WSRMSequenceTerminatedException when the session between this application
* and the target endpoint has already been terminated.
*
* Throws WSRMSequenceUnknownException exception when either reliable messaging is not engaged to
* the specified endpoint url or the sequence has previously been terminated and removed.
*
* @param clientObject The JAX-WS Dispatch instance, or the Dynamic Proxy client instance.
* @param endPointUri The target endpoint url
* @throws WSRMNotEnabledException
*
* @throws WSRMSequenceTerminatedException
* @throws WSRMSequenceUnknownException
*/
public void terminateSequence(Object clientObject, QName portQName, String endPointUri) throws WSRMNotEnabledException;
- 시퀀스가 완료되길 기다리는 코드를 추가하십시오.
신뢰할 수 있는 메시징 시퀀스를 완료하기
위해 대기하려면 대상 서비스가 모든 메시지를 전송하고 수신확인했는지
확인하는 메소드 호출을 사용합니다. 시퀀스가 완료되면 시퀀스가 종료되고
정리됩니다.
waitUntilSequenceCompleted 메소드 사용에는
두 가지 방법이 있습니다.
public boolean waitUntilSequenceCompleted(Object clientObject,
QName portQName, String endPointUri, long waitTime)
이 메소드 호출은
완료할 신뢰할 수 있는 메시징 시퀀스에 지정된 waitTime 동안 대기합니다.
지정된 시간 내에 시퀀스가 완료되지 않으면 메소드가 false를 리턴합니다.
시퀀스가 시간 내에 완료되면 메소드가 true를 리턴합니다.
public boolean waitUntilSequenceCompleted(Object clientObject,
QName portQName, String endPointUri)
이 메소드 호출은 신뢰할 수 있는
메시징 시퀀스가 완료될 때까지 리턴하지 않습니다.