대기 중 활동에 메시지 전송

이 타스크의 수행 목적 및 시기

pick 활동(receive choice 활동이라고도 함) 및 receive 활동을 사용하여 실행 중인 프로세스를 "외부" 이벤트와 동기화시킬 수 있습니다. 예를 들어 정보 요청에 대해 고객이 응답으로 보낸 전자 우편을 수신하는 것이 해당 이벤트가 될 수 있습니다.

이 타스크의 단계

  1. 로그온 사용자의 메시지를 대기하는 활동 서비스 템플리트를 나열하십시오.
    QueryResultSet result = 
       process.query("ACTIVITY_SERVICE.VTID,ACTIVITY.ATID", 
                     "ACTIVITY.STATE=ACTIVITY.STATE.STATE_WAITING AND
                      ACTIVITY_SERVICE.PORT_TYPE='Confectionery' AND
                      ACTIVITY_SERVICE.OPERATION='OrderRequest' AND
                      WORK_ITEM.REASON=WORK_ITEM.REASON.REASON_POTENTIAL_OWNER",
                      null, null, null); 
  2. 메시지를 전송합니다.

    호출자는 메시지를 수신하는 활동의 잠재적 소유자이거나 프로세스 인스턴스 관리자여야 합니다.

    if ( result.size() > 0 )
    {
      result.first();
      VTID vtid = (VTID)result.getOID(1);
      ATID atid = (ATID)result.getOID(2); 
      ActivityServiceTemplateData activity = 
              process.getActivityServiceTemplate(vtid,atid);
    
      // create a message for the service to be called
      ClientObjectWrapper message = 
            process.createMessage(vtid,atid,activity.getInputMessageTypeName()); 
      DataObject myMessage = null;
      if ( message.getObject()!= null && message.getObject() instanceof DataObject )
      {
        myMessage = (DataObject)message.getObject();
        //set the strings in the message, for example, chocolate is to be ordered
        myMessage.setString("Order", "chocolate");
      }
    
      // send the message to the waiting activity 
      process.sendMessage(vtid, atid, message);  
    }

    이 조치는 지정된 메시지를 대기 중 활동 서비스로 전송하고 일부 순서 데이터를 전달합니다.

    프로세스 인스턴스 ID를 지정하여 메시지가 지정된 프로세스 인스턴스에 전송되는지 확인할 수도 있습니다. 프로세스 인스턴스 ID가 지정되지 않는 경우 메시지가 메시지의 상관 값에서 식별한 프로세스 인스턴스 및 활동 서비스로 전송됩니다. 프로세스 인스턴스 ID가 지정된 경우 상관 값을 사용해 찾은 프로세스 인스턴스를 확인하여 지정된 프로세스 인스턴스 ID를 갖는지 확인하십시오.

관련 개념
비즈니스 프로세스 및 타스크 관련 오브젝트에 대한 조회

Terms of use |

Last updated: Thu Mar 23 18:55:29 2006

(c) Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)