This file contains 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
%% Mingle n lists by successively taking elements of each list. The lists don't need to be of the same size. | |
%% @spec mingle(ListOfLists::[List::[term()]]) -> Result::[term()] | |
mingle(ListOfLists) -> | |
mingle(ListOfLists, []). | |
mingle([], Result) -> | |
lists:reverse(Result); | |
mingle(ListOfLists, Result) -> | |
{NewListOfLists, NewResult} = | |
lists:foldl(fun(List, {ListOfListsAcc, ResultAcc}) -> | |
case List of |
This file contains 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
// imports omitted for brevity | |
/** | |
* A POJO that can add a configured list of file endpoints to the inbound router of a service. | |
* | |
* @author <a href="mailto:[email protected]">David Dossot</a> | |
*/ | |
public class InboundFileEndpointConfigurer implements MuleContextAware { | |
private MuleContext muleContext; | |
private Service targetService; |
This file contains 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
<spring:bean class="InboundFileEndpointConfigurer" | |
p:targetService-ref="FileJobAcceptor" | |
p:connector-ref="NonDeletingFileConnector" | |
p:configuration-ref="MyConfiguration" | |
init-method="initialize" /> |
This file contains 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
<service name="FileJobAcceptor"> | |
<inbound /> | |
<outbound> | |
<pass-through-router> | |
<outbound-endpoint ref="..."> | |
</outbound> | |
</service> |
This file contains 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
<service name="load-throttler"> | |
<inbound> | |
<http:inbound-endpoint address="http://localhost:9500/throttler" | |
synchronous="false" /> | |
</inbound> | |
<outbound> | |
<pass-through-router> | |
<http:outbound-endpoint address="http://localhost:9600/application" | |
synchronous="false" /> | |
</pass-through-router> |
This file contains 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
$ time for (( i = 0 ; i < 10; i++ )); do curl -d "msg$i" http://localhost:9600/application ; done | |
real 0m10.157s | |
user 0m0.064s | |
sys 0m0.048s |
This file contains 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
$ time for (( i = 0 ; i < 10; i++ )); do curl -d "msg$i" http://localhost:9500/throttler ; done | |
real 0m0.310s | |
user 0m0.052s | |
sys 0m0.020s |
This file contains 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
<vm:connector name="vmConnector"> | |
<vm:queue-profile persistent="true" maxOutstandingMessages="10000" /> | |
</vm:connector> | |
... | |
<service name="persistent-load-throttler-in"> | |
<inbound> | |
<http:inbound-endpoint address="http://localhost:9500/throttler" synchronous="false" /> | |
</inbound> |
This file contains 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
<service name="load-throttler"> | |
<inbound> | |
<http:inbound-endpoint address="http://localhost:9500/throttler" | |
synchronous="false" /> | |
</inbound> | |
<outbound> | |
<pass-through-router> | |
<http:outbound-endpoint address="http://localhost:9600/application" | |
synchronous="false" /> | |
</pass-through-router> |
This file contains 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
$ time for (( i = 0 ; i < 10; i++ )); do curl -d "msg$i" http://localhost:9600/application ; done | |
real 0m10.157s | |
user 0m0.064s |
OlderNewer