本文整理汇总了Java中org.mule.api.MuleException类的典型用法代码示例。如果您正苦于以下问题:Java MuleException类的具体用法?Java MuleException怎么用?Java MuleException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MuleException类属于org.mule.api包,在下文中一共展示了MuleException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startMuleContext
import org.mule.api.MuleException; //导入依赖的package包/类
private void startMuleContext(ApplicationContext parent) {
if (muleContext == null) {
DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
try {
SpringXmlConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder(config);
StaticApplicationContext staticApplicationContext = new StaticApplicationContext(parent);
staticApplicationContext.refresh();
configBuilder.setParentContext(staticApplicationContext);
muleContext = muleContextFactory.createMuleContext(configBuilder);
muleContext.start();
} catch (MuleException e) {
throw new RuntimeException(e);
}
}
}
示例2: getMessageStream
import org.mule.api.MuleException; //导入依赖的package包/类
/**
* Gets the stream representation of the current message.
*
* @param context the event context
* @return The inputstream for the current message
* @throws MuleException
*/
protected InputStream getMessageStream(MuleEventContext context) throws MuleException
{
InputStream is;
Object eventMsgPayload = context.transformMessage();
if (eventMsgPayload instanceof InputStream)
{
is = (InputStream) eventMsgPayload;
}
else
{
is = (InputStream) context.transformMessage(InputStream.class);
}
return is;
}
示例3: dispatch
import org.mule.api.MuleException; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public synchronized void dispatch(final MoverMessage inMessage,
final String inEndpointURI) throws TransportException {
try {
@SuppressWarnings("unchecked")
final MoverMessage<MuleMessage> theMuleMoverMessage = inMessage;
mMuleClient.dispatch(inEndpointURI, theMuleMoverMessage
.getMessage());
LOGGER.debug("Sent message: {}", inMessage);
} catch (MuleException theException) {
throw new TransportException("Error occurred sending message",
theException);
}
}
示例4: receive
import org.mule.api.MuleException; //导入依赖的package包/类
@Override
public synchronized MoverMessage<MuleMessage> receive(
final String inEndpointURI, final long inTimeout)
throws TransportException {
MuleMessage theReceivedMsg = null;
MoverMessage<MuleMessage> theMoverMessage = null;
try {
theReceivedMsg = mMuleClient.request(inEndpointURI, inTimeout);
LOGGER.debug("Received message: {}", theReceivedMsg);
} catch (MuleException theException) {
throw new TransportException("Error occurred receiving message",
theException);
}
if (theReceivedMsg != null) {
theMoverMessage = new MuleMoverMessage(theReceivedMsg);
}
return theMoverMessage;
}
示例5: testMarkPaymentProcessed
import org.mule.api.MuleException; //导入依赖的package包/类
@Test
public void testMarkPaymentProcessed() throws MuleException {
FakeShopserviceImplementation fakeShop = muleContext.getRegistry().lookupObject("fakeShop");
fakeShop.markOrderAsPaid("first");
fakeShop.markOrderAsPaid("second");
GetUnprocessedPaymentsResponse response = (GetUnprocessedPaymentsResponse) call("getUnprocessedPayments", null);
List<String> list = response.getPayments();
assertEquals(2, list.size());
assertEquals("first", list.get(0));
assertEquals("second", list.get(1));
call("markPaymentProcessed", "first");
response = (GetUnprocessedPaymentsResponse) call("getUnprocessedPayments", null);
list = response.getPayments();
assertEquals(1, list.size());
assertEquals("second", list.get(0));
}
示例6: processBlocking
import org.mule.api.MuleException; //导入依赖的package包/类
@Override
protected MuleEvent processBlocking(MuleEvent event) throws MuleException {
MessagingException exception = null;
final String origin = event.getMessage().getInboundProperty(HttpHeaders.Names.ORIGIN);
final String method = event.getMessage().getInboundProperty(HttpConstants.RequestProperties.HTTP_METHOD_PROPERTY);
final String requestMethod = event.getMessage().getInboundProperty(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_METHOD);
final String requestHeaders = event.getMessage().getInboundProperty(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_HEADERS);
try {
return processResponse(origin, method, requestMethod, requestHeaders, processNext(processRequest(event)));
} catch (MessagingException e) {
exception = e;
throw e;
} finally {
processFinally(event, exception, origin, method, requestMethod, requestHeaders);
}
}
示例7: listener
import org.mule.api.MuleException; //导入依赖的package包/类
/**
* Subscribe for Mule events under the specified topic name
* <p/>
* {@sample.xml ../../../doc/pubsub-module.xml.sample pubsub:listener}
*
* @param topic Name of the topic
* @param callback flow to process
*/
@Source(exchangePattern = MessageExchangePattern.ONE_WAY)
public void listener(String topic, final SourceCallback callback) {
ITopic hazelcastTopic = HazelcastManager.getInstance().getHazelcastInstance().getTopic(topic);
hazelcastTopic.addMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
Thread.currentThread().setContextClassLoader(muleContext.getExecutionClassLoader());
MuleEvent newEvent = createMuleEvent(message);
// process it
try {
callback.processEvent(newEvent);
} catch (MuleException e) {
LOGGER.error(e.getMessage(), e);
}
}
});
}
示例8: main
import org.mule.api.MuleException; //导入依赖的package包/类
public static void main(String[] args) throws MuleException
{
setProperty("ebms.mode",new String[]{"normal","oracle"},"normal");
setProperty("ebms.protocol",new String[]{"http","https"},"http");
setProperty("ebms.database",new String[]{"hsqldb","mysql","postgresql","mssql","oracle"},"hsqldb");
DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
SpringXmlConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder(args.length == 0 ? "main.xml" : args[0]);
MuleContext muleContext = muleContextFactory.createMuleContext(configBuilder);
muleContext.start();
}
示例9: aggregate
import org.mule.api.MuleException; //导入依赖的package包/类
@Override
public MuleEvent aggregate(AggregationContext context) throws MuleException {
VerificaCreditoResponse resultado = new VerificaCreditoResponse();
resultado.setCredito(new Credito());
for (MuleEvent event : context.getEvents()) {
CreditoMappingStrategyFactory.mapCredito(event.getMessage().getPayload(), resultado.getCredito());
}
boolean aprovado = resultado.getCredito().isCasasBahia() && resultado.getCredito().isSerasa() && resultado.getCredito().isSpc();
resultado.getCredito().setAprovado(aprovado);
MuleMessage response = new DefaultMuleMessage((Object) resultado, context.getOriginalEvent().getMuleContext());
return new DefaultMuleEvent(response, context.getOriginalEvent(), context.getOriginalEvent().getSession());
}
示例10: contextInitialized
import org.mule.api.MuleException; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
try {
logger.info("Starting Mule...");
String[] flows = new String[] { "wundershop.xml", "fakeshopsystem.xml" };
SpringXmlConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder(flows);
muleContext = muleContextFactory.createMuleContext(configBuilder);
muleContext.start();
logger.info("Mule started");
} catch (MuleException e) {
throw new RuntimeException(e);
}
}
示例11: contextDestroyed
import org.mule.api.MuleException; //导入依赖的package包/类
@Override
public void contextDestroyed(ServletContextEvent event) {
try {
logger.info("Stopping Mule...");
muleContext.stop();
muleContext.getWorkManager().dispose();
muleContext.dispose();
logger.info("Mule stopped");
} catch (MuleException e) {
throw new RuntimeException(e);
} finally {
muleContext = null;
}
}
示例12: order
import org.mule.api.MuleException; //导入依赖的package包/类
@PUT
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.TEXT_PLAIN)
public String order(String json) throws MuleException {
MuleClient client = context.getClient();
client.send("vm://vm-order", json, null);
return "Order received, starting workflow...";
}
示例13: callMule
import org.mule.api.MuleException; //导入依赖的package包/类
public void callMule(DelegateExecution execution, ProcessVariableAccessor variables) throws MuleException {
if (status.getValue(execution)==null) {
throw new RuntimeException("You have to configure the " + this.getClass().getName() + " with the status value in your BPMN process model on activity " + execution.getCurrentActivityName());
}
// Check that the enum value is correct
ShopStatus shopStatus = ShopStatus.valueOf((String)status.getValue(execution));
Object args[] = new Object[] {
variables.getBestellung().getId(), //
shopStatus};
callMuleFlowSync("set-status", args, null);
}
示例14: callMule
import org.mule.api.MuleException; //导入依赖的package包/类
public void callMule(DelegateExecution execution, ProcessVariableAccessor variables) throws MuleException {
Object args[] = new Object[] {
variables.getBestellung().getId(), //
ShopStatus.CONFIRMED };
callMuleFlowSync("set-status", args, null);
}
示例15: testSetStatusFlow
import org.mule.api.MuleException; //导入依赖的package包/类
@Test
public void testSetStatusFlow() throws MuleException {
FakeShopserviceImplementation fakeShop = muleContext.getRegistry().lookupObject("fakeShop");
MuleClient client = muleContext.getClient();
Object args[] = new Object[] { "id", ShopStatus.SHIPPED };
MuleMessage reply = client.send("vm://set-status", args, null);
assertNotNull(reply);
assertEquals(ShopStatus.SHIPPED, fakeShop.getStatus("id"));
}