配置 Meta 物件屬性

WebSphere Commerce 的配接器可辨識和讀取兩種 Meta 物件:

動態子 meta 物件的屬性值會重複並置換靜態 meta 物件的屬性值。

靜態 Meta 物件

WebSphere Commerce 靜態 Meta 物件包含為不同商業物件所定義的轉換內容清單。 若要定義商業物件的轉換內容,請先使用語法 busObj_verb 來建立字串屬性並且命名。 例如,若要使用動詞 Create 來定義 Customer 物件的轉換內容, 請建立命名為 Customer_Create 的屬性。 於屬性的特定應用程式文字中,您再指定實際的轉換內容。

此外,於 meta 物件中可定義一個名為 Default 的保留屬性。 當這個屬性出現時,其內容可作為所有商業物件轉換內容的預設值。

註:
若未指定靜態 meta 物件,則於輪詢期間,連接器無法將特定的 訊息格式對映至特定的商業物件類型。 此情況下,連接器會將訊息文字傳送至已配置的資料處理常式, 但不指定商業物件。 若資料處理常式無法僅依據文字來建立商業物件, 配接器會報告錯誤,指出無法辨識這個訊息格式。

表 13 說明 meta 物件內容。

表 13. WebSphere Commerce 靜態 meta 物件內容
內容名稱 說明
CollaborationName
註:
這個內容僅適用於同步事件處理, 此配接器版本中並不支援。
DataEncoding

DataEncoding 是用來讀寫訊息的編碼。 若於靜態 meta 物件中未指定這個內容,連接器會嘗試不使用任何特定編碼來讀取訊息。 動態子 meta 物件中定義的 DataEncoding 將置換靜態 meta 物件中定義的值。 預設值是 Text。 此屬性的值格式為 messageType[:enc]。亦即,Text:ISO8859_1Text:UnicodeLittleTextBinary

DataHandlerConfigMO

傳送至資料處理常式以提供配置資訊的 meta 物件。 若指定於靜態 meta 物件中,則會置換 DataHandlerConfigMO 連接器內容中所指定的值。 若於動態子 meta 物件中定義這個內容, 則會置換連接器內容和靜態 meta 物件內容。 指定的商業物件必須是配接器支援的物件。

DataHandlerMimeType

依據特定 MIME 類型來指定資料處理常式。 您必須使用 text/xmlMIME 類型,才可讓配接器與 WebSphere Commerce 相互作用。

若於靜態 meta 物件中指定這個內容,則會置換 DataHandlerMimeType 連接器內容中指定的值。 若於動態子 meta 物件中定義這個內容, 則會置換連接器內容和靜態 meta 物件內容。 DataHandlerConfigMO 中指定的商業物件應有一個屬性對映至這個內容的值。

DoNotReportBusObj

使用者可以選擇併入 DoNotReportBusObj 內容。 若將這個內容設為 true,則所有發出的 PAN 報告訊息有空白的訊息主體。 當要求者想要確認要求已順利處理,但不需要商業物件的變更通知時,建議採用這項設定。 這不影響 NAN 報告。

若於靜態 meta 物件中找不到這個內容, 配接器將預設為 false,並於訊息報告中加入商業物件。

註:
這個內容僅適用於同步事件處理, 此配接器版本中並不支援。
InputFormat

InputFormat 為給定之商業物件相關的訊息格式。 如果可能,擷取的訊息使用這種格式時,會轉換成給定的商業物件。

OutputFormat

OutputFormat 設定於所給定之商業物件所建立的訊息上。 如果未指定 OutputFormat,則採用輸入格式(如果可用)。 動態子 meta 物件中定義的 OutputFormat 會置換靜態 meta 物件中定義的值。

InputQueue 連接器輪詢來偵測新訊息的輸入佇列。您可以使用連接器特有內容來配置多重 InputQueues,以及選擇性地將不同 的資料處理常式對映到每一個佇列。
OutputQueue

從給定的商業物件送出的訊息會傳遞至這個 OutputQueue 輸出佇列。 動態子 meta 物件中定義的 OutputQueue 會置換靜態 meta 物件中定義的值。

ResponseTimeout

表示等待回應時,逾時之前的時間長度(毫秒)。 若保留成未定義或指定的值小於零,則配接器不等待回應就立即傳回 SUCCESS。 動態子 meta 物件中定義的 ResponseTimeout 會置換靜態 meta 物件中定義的值。

TimeoutFatal

如果定義這個內容且值為 True,則當 ResponseTimeout 指定的時間內未收到回應時,配接器會傳回 APP_RESPONSE_TIMEOUT。 所有其他正在等待回應訊息的執行緒,會立即將 APP_RESPONSE_TIMEOUT 傳回到 InterChange Server。 這會導致 InterChange Server 終止配接器。 動態子 meta 物件中定義的 TimeoutFatal 會置換靜態 meta 物件中定義的值。


表 14. Customer_Create 的 JMS 靜態 meta 物件結構
屬性名稱 特定應用程式文字
Customer_Create DataEncoding=Text:UnicodeLittle; InputFormat=CUST_IN; OutputFormat=CUST_OUT; OutputQueue=QueueA; ResponseTimeout=10000; TimeoutFatal=False

特定應用程式文字

特定應用程式文字的結構是名稱/值組的格式,且以分號來區隔。 例如:

InputFormat=CUST_IN;OutputFormat=CUST_OUT
 

將資料處理常式對映到 InputQueues

您可以使用靜態 Meta 物件的特定應用程式資訊中的 InputQueue 內容,來建立資料處理常式與輸入佇列的關聯性。當處理具有不同格式和轉換需求的多個交易友機時,此功能很有幫助。 若要這麼做,您必須:

  1. 使用連接器特有內容 (請參閱InputQueue) 來配置一或多個輸入佇列。
  2. 針對每一個輸入佇列,在特定應用程式資訊中指定佇列管理程式和輸入佇列名稱,以及資料處理常式類別名稱和 MIME 類型。

例如,靜態 Meta 物件中的下列屬性可建立資料處理常式與 InputQueue (名稱為 CompReceipts) 的關聯性:

   [Attribute]
 Name = Cust_Create
    Type = String
    Cardinality = 1
    MaxLength = 1
    IsKey = false
    IsForeignKey = false
    IsRequired = false
 AppSpecificInfo = InputQueue=//queue.manager/CompReceipts;
   DataHandlerClassName=com.crossworlds.
 DataHandlers.MQ.disposition_notification;DataHandlerMimeType=message/
 disposition_notification
    IsRequiredServerBound = false
 [End]
 

超載輸入格式

於擷取訊息時,連接器通常會比對輸入格式與一個特定商業物件和動詞組合。 然後,配接器將商業物件名稱和訊息內容傳送至資料處理常式。 此可讓資料處理常式驗證訊息內容是否對應於使用者預期的商業物件。

然而,若為多個商業物件定義相同輸入格式, 則連接器將資料傳送到資料處理常式之前,無法判斷資料所代表的商業物件。 此情況下,配接器僅將訊息內容傳送到資料處理常式, 然後依據已產生的商業物件來查閱轉換內容。 因此,資料處理常式必須僅依據訊息內容來判斷商業物件。

若未設定已產生之商業物件的動詞,則連接器會使用任何動詞來 搜尋針對這個商業物件所定義的轉換內容。 如果只找到一組轉換內容,連接器會指派指定的動詞。 如果找到多個內容,連接器會讓訊息失敗,因為無法區別動詞。

範例 Meta 物件

以下顯示的 meta 物件將連接器配置成使用動詞 Create 來轉換 Customer 商業物件。

[BusinessObjectDefinition]
 Name = MO_WebSphereCommerceConfig
 Version = 3.0.0
  
    [Attribute]
    Name = Default
    Type = String
    MaxLength = 1
    IsKey = true
    IsForeignKey = false
    IsRequired = false
    AppSpecificInfo = OutputQueue=queue://<Queue Manager
     Name>/WCS_Serial_Inbound?targetClient=1;
      OutputFormat=MQSTR
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = WCS_Create_WCS_Customer_Create
    Type = String
    MaxLength = 255
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    AppSpecificInfo = OutputQueue=queue://<Queue Manager
     Name>/WCS_Serial_Inbound?targetClient=1;
      OutputFormat=MQSTR
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = WCS_Report_NC_PurchaseOrder_Create
    Type = String
    MaxLength = 255
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    AppSpecificInfo = InputFormat=MQSTR
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = ObjectEventId
    Type = String
    MaxLength = 255
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
  
    [Verb]
    Name = Create
 [End]
  
    [Verb]
    Name = Delete
 [End]
  
    [Verb]
    Name = Retrieve
 [End]
  
    [Verb]
    Name = Update
 [End]
 [End]
 

動態子 meta 物件

若很難透過靜態 meta 物件來指定 meta 物件, 則連接器可接受執行時期為每一個商業物件實例所指定的 meta 資料。

連接器將辨識並讀取動態 meta 物件的轉換內容, 這個物件在傳送至連接器的最上層商業物件上新增為子物件。 動態子 meta 物件的屬性值會重複轉換內容, 您可透過用來配置連接器的靜態 meta 物件指定這些轉換內容。

因為動態子 meta 物件內容會置換靜態 meta 物件中找到的內容, 所以若您指定動態子 meta 物件,則不必併入用來指定靜態 meta 物件的連接器內容。 因此,您可自由地使用動態子 meta 物件, 不需考慮靜態 meta 物件,反之亦然。

表 14表 15 分別顯示商業物件 Customer_Create 的範例靜態和動態子 meta 物件。 請注意,特定應用程式文字包含區隔名稱/值組的分號。

表 15. Customer_Create 的 WebSphere Commerce 動態子項 Meta 物件結構
屬性名稱
DataEncoding Text:UnicodeLittle
DataHandlerMimeTypea text/delimited
OutputFormat CUST_OUT
OutputQueue QueueA
ResponseTimeout 10000
TimeoutFatal False

a. 假設 DataHandlerConfigMO 已指定於連接器配置內容或靜態 meta 物件中。

連接器將檢查最上層商業物件的特定應用程式文字, 判斷標籤 cw_mo_conn 是否指定子 meta 物件。 若已指定,動態子 meta 物件值會置換靜態 meta 物件中指定的值。

輪詢期間的活動

為了向協同作業實例提供更多輪詢期間所擷取的訊息資訊, 連接器會移入動態 meta 物件的特定屬性(如果已經針對已建立的商業物件定義的話)。

表 16 顯示如何建構動態子 meta 物件以執行輪詢。

表 16. 針對輪詢的 JMS 動態子 meta 物件結構
屬性名稱 範例值
InputFormat CUST_IN
InputQueue MYInputQueue
OutputFormat CxIgnore
OutputQueue CxIgnore
ResponseTimeout CxIgnore
TimeoutFatal CxIgnore

表 16 所示, 您可於動態子 meta 物件中定義 InputQueue 這個額外的屬性。 這個屬性包含已從中擷取指定訊息的佇列名稱。 如果子 meta 物件中未定義這個內容,則不會輸入資料。

範例實務:

範例動態子 meta 物件

[BusinessObjectDefinition]
 Name = MO_Sample_Config
 Version = 1.0.0
  
    [Attribute]
    Name = OutputFormat
    Type = String
    MaxLength = 1
    IsKey = true
    IsForeignKey = false
    IsRequired = false
    DefaultValue = CUST
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = OutputQueue
    Type = String
    MaxLength = 1
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    DefaultValue = OUT
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = ResponseTimeout
    Type = String
    MaxLength = 1
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    DefaultValue = -1
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = TimeoutFatal
    Type = String
    MaxLength = 1
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    DefaultValue = false
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = InputFormat
    Type = String
    MaxLength = 1
    IsKey = true
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = InputQueue
    Type = String
    MaxLength = 1
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = ObjectEventId
    Type = String
    MaxLength = 255
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
  
    [Verb]
    Name = Create
 [End]
  
    [Verb]
    Name = Delete
 [End]
  
    [Verb]
    Name = Retrieve
 [End]
  
    [Verb]
    Name = Update
 [End]
 [End]
 [BusinessObjectDefinition]
 Name = Customer
 Version = 1.0.0
 AppSpecificInfo = cw_mo_conn=MyConfig
  
    [Attribute]
    Name = FirstName
    Type = String
    MaxLength = 1
    IsKey = true
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = LastName
    Type = String
    MaxLength = 1
    IsKey = true
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = Telephone
    Type = String
    MaxLength = 1
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = MyConfig
    Type = MO_Sample_Config
    ContainedObjectVersion = 1.0.0
    Relationship = Containment
    Cardinality = 1
    MaxLength = 1
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
    [Attribute]
    Name = ObjectEventId
    Type = String
    MaxLength = 255
    IsKey = false
    IsForeignKey = false
    IsRequired = false
    IsRequiredServerBound = false
 [End]
  
    [Verb]
    Name = Create
 [End]
  
    [Verb]
    Name = Delete
 [End]
  
    [Verb]
    Name = Retrieve
 [End]
  
    [Verb]
    Name = Update
 [End]
 [End]
 

Copyright IBM Corp. 1997, 2003