This section provides the details on creating the component classes that are used in the mule-config.xml
1. Create GetShippingInfoComponent.java
package org.mybusiness.shippingservice.components; import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.services.shippingservice.GetShippingInfoRequest; import com.services.shippingservice.GetShippingInfoResponse; public class GetShippingInfoComponent { Log LOG = LogFactory.getLog(OrderShippingComponent.class); public GetShippingInfoResponse getShippingInfo( GetShippingInfoRequest request) { if (LOG.isInfoEnabled()) { LOG.info("" + request.getConfirmationNo()); } GetShippingInfoResponse response = new GetShippingInfoResponse(); response.setCurrentStatus("In Processing"); response.setEstimatedDeliveryDate(new Date() + ""); response.setOrderNo("12"); return response; } }
2. Create OrderShippingInfoComponent.java
package org.mybusiness.shippingservice.components; import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.services.shippingservice.OrderShippingRequest; import com.services.shippingservice.OrderShippingResponse; public class OrderShippingComponent { Log LOG = LogFactory.getLog(OrderShippingComponent.class); public OrderShippingResponse orderShipping(OrderShippingRequest request) { if (LOG.isInfoEnabled()) { LOG.info("Item No:" + request.getItemNo()); LOG.info("Item Qty:" + request.getItemQty()); LOG.info("Order No:" + request.getOrderNo()); } OrderShippingResponse response = new OrderShippingResponse(); response.setConfirmationNo("123"); response.setEstimatedDate(new Date() + ""); return response; } }
3. Start the server.
- Right click on mule-config.xml and select Run As->Mule Server. The server should get started successfully without any errors.
Startup log |
No comments:
Post a Comment