¾Æ¿ô¹Ù¿îµå ¸Þ½ÃÁö ½Ã½ºÅÛ ÀÎÅÍÆäÀ̽º ÇÁ·Î±×·¡¹Ö ¿¹

´ÙÀ½ Java ÄÚµå ¼¼±×¸ÕÆ®¿¡´Â ¾Æ¿ô¹Ù¿îµå ¸Þ½ÃÁö ½Ã½ºÅÛ°úÀÇ »óÈ£ÀÛ¿ëÀÌ ¹ß»ýÇÒ ¼ö ÀÖ´Â ¹æ¹ýÀÌ ³ª¿Í ÀÖ½À´Ï´Ù. ¿¹ 1¿¡´Â »õ XML ¸Þ½ÃÁö¸¦ ÀÛ¼ºÇÏ¿© ¾Æ¿ô¹Ù¿îµå ¸Þ½ÃÁö ½Ã½ºÅÛÀ» ÅëÇØ À̸¦ º¸³»´Â ¹æ¹ýÀÌ ³ª¿Í ÀÖ½À´Ï´Ù. ¿¹ 2¿¡¼­´Â ÀüÀÚ ¿ìÆí ¸Þ½ÃÁö¸¦ ÀÛ¼ºÇÏ´Â ¹æ¹ý°ú ¾Æ¿ô¹Ù¿îµå ¸Þ½ÃÁö ½Ã½ºÅÛÀ» ÅëÇØ ¸Þ½ÃÁö¸¦ º¸³»´Â ¹æ¹ýÀÌ ³ª¿Í ÀÖ½À´Ï´Ù.

¿¹ 1

try
{
com.ibm.commerce.messaging.commands.SendMsgCmd api =
(com.ibm.commerce.messaging.commands.SendMsgCmd)
CommandFactory.createCommand(SendMsgCmd.NAME, getStoreId());
// Assume you have set the msgType in the MSGTYPES table to 100 and you are using
// storeId of 1.
api.setMsgType(new Integer(100));
api.setStoreID(new Integer(1));
 
// You have to choice on how to build the msg:
// First choice: build your xml msg in a String object and then use the setContent().
String OrderCreateMsg = new String("<?xml version="1.0" encoding="UTF-8"?> ...");
api.setContent(OrderCreateMsg);
 
// Or, use the message composition services (compose()) by passing the template/view name
// This view name should be registered in VIEWREG and MSGTYPES tables referring to
// a JSP message layout template.
String viewName = new String("OrderCreateMsgView");
TypedProperty tp = new TypedProperty();
// get the orderRefNumber and put it into tp
tp.put("ORDER_REF_NUMBER", getOrderRn().toString());
// get the languageId and put it into tp
tp.put("LANGUAGE_ID", getCommandContext().getLanguageId());
// Pass the viewName, command Context and parameters stored in tp to compose services.
// Upon successful completion, a message is build according to message layout defined in the
// JSP message layout template referred by viewName.
api.compose(viewName, getCommandContext(), tp);
 
// Send out the message using sendTransacted send service.
api.sendTransacted();
// Set the command context obtained from the controller command.
api.setCommandContext(getCommandContext());
// Run the outbound messaging system services
api.execute();
}
catch (Exception ex )
{
ex.printStackTrace(System.err);
}

¿¹ 2

try
{
com.ibm.commerce.messaging.commands.SendMsgCmd api =
(com.ibm.commerce.messaging.commands.SendMsgCmd)
CommandFactory.createCommand(SendMsgCmd.NAME, getStoreId());
// Assume you have set the msgType in the MSGTYPES table to 200 and you are using
// storeId of 1.
api.setMsgType(new Integer(200));
api.setStoreID(new Integer(1));
 
// You have to choice on how to build the msg:
// First choice: build your xml msg in a String object and then use the setContent().
String OrderNotifyMsg =
new String("Your Order has been received. Thank You for Shopping with us.");
api.setContent(OrderNotifyMsg);
 
// Or, use the message composition services (compose()) by passing the template/view name
// This view name should be registered in VIEWREG and MSGTYPES tables referring to
// a JSP message layout template.
String viewName = new String("OrderNotifyMsgView");
TypedProperty tp = null;
// Pass the viewName, command Context and null parameter stored in tp to compose services.
// Upon successful completion, a message is build according to message layout defined in the
// JSP message layout template referred by viewName.
api.compose(viewName, getCommandContext(), tp);
 
// Set the subject, recipient and sender information using Configurable message data services
api.setConfigData("subject","Your Order has been received");
api.setConfigData("recipient",getEmailAddress());
api.setConfigData("sender","storeAdmin@storeABC.com);
// Send out the message using sendImmediate send service.
api.sendImmediate();
// Set the command context obtained from the controller command.
api.setCommandContext(getCommandContext());
// Run the outbound messaging system services
api.execute();
}
catch (Exception ex )
{
ex.printStackTrace(System.err);

°ü·Ã °³³ä

°ü·ÃµÈ ÂüÁ¶

IBM copyright