This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module(name = "validator", schemaVersion = "1.0-SNAPSHOT") | |
public class ValidatorModule { | |
/** | |
* Processor to filter our invalid products from a List payload. | |
* <p/> | |
* {@sample.xml ../../../doc/Validator-connector.xml.sample validator:my-processor} | |
* | |
* @param products The products to validate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<validator:product/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="Product Submission"> | |
<http:inbound-endpoint address="http://localhost:8080/products"/> | |
<byte-array-to-string-transformer/> | |
<json:json-to-object-transformer returnClass="java.util.ArrayList"/> | |
<validator:product/> | |
<vm:outbound-endpoint path="products.out"/> | |
</flow> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mvn archetype:generate -DarchetypeGroupId=org.mule.tools.devkit -DarchetypeArtifactId=mule-devkit-archetype-generic -DarchetypeVersion=3.0.1 -DarchetypeRepository=http://repository.mulesoft.org/releases/ -DgroupId=com.acmesoft -DartifactId=circuit-breaker-module -Dversion=1.0-SNAPSHOT -DmuleVersion=3.2.0 -DmuleModuleName=CircuitBreaker -DmuleModulePackage=com.acmesoft.integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<circuitbreaker:config breakerName="testingBreaker" tripThreshold="5" tripTimeout="300000"/> | |
<flow name="testFlow"> | |
<vm:inbound-endpoint path="vm.in"/> | |
<circuitbreaker:filter/> | |
<test:component throwException="true"/> | |
<vm:outbound-endpoint path="vm.out"/> | |
<default-exception-strategy> | |
<circuitbreaker:trip tripOnException="org.mule.tck.exceptions.FunctionalTestException"/> | |
</default-exception-strategy> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Mule Development Kit | |
* Copyright 2010-2011 (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom processor | |
* <p/> | |
* {@sample.xml ../../../doc/CircuitBreaker-connector.xml.sample circuitbreaker:trip} | |
* | |
* @param exceptionMessage The exception. | |
* @param tripOnException The exception type we should trip on. | |
* @return Some string | |
*/ | |
@Processor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom processor | |
* <p/> | |
* {@sample.xml ../../../doc/CircuitBreaker-connector.xml.sample circuitbreaker:filter} | |
* | |
* @param payload The message payload | |
* @return Some string | |
*/ | |
@Processor | |
public Object filter(@Payload Object payload) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integer getFailureCount() { | |
try { | |
objectStoreMutex.acquire(); | |
} catch (InterruptedException e) { | |
logger.error("Could not acquire mutex", e); | |
} | |
ObjectStore objectStore = objectStoreManager.getObjectStore(MuleProperties.OBJECT_STORE_DEFAULT_PERSISTENT_NAME); | |
String key = String.format("%s.failureCount", breakerName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="testFlow"> | |
<vm:inbound-endpoint path="in"/> | |
<esper:send eventPayload-ref="#[payload:]"/> | |
<vm:outbound-endpoint path="out"/> | |
</flow> | |
<flow name="Event Listener Flow"> | |
<esper:listen statement="select count(*) from TestEvent | |
.win:time_batch(5, 'FORCE_UPDATE, START_EAGER') having count(*) > 0"/> | |
<esper:get-event-property key="count(*)"/> |