Last active
July 19, 2018 20:13
-
-
Save bibryam/5120d55277684a80bd23a18591070607 to your computer and use it in GitHub Desktop.
A Camel route that listens for CallbackGetBTCCap events and calls setBTCCap with a random value
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
| @Override | |
| public void configure() throws Exception { | |
| from("web3j://http://127.0.0.1:7545?operation=ETH_LOG_OBSERVABLE&topics=" + topics) | |
| .to("log:com.ofbizian.CallbackGetBTCCap?level=INFO&showAll=true") | |
| .setHeader(OPERATION, constant(ETH_SEND_TRANSACTION)) | |
| .setHeader(FROM_ADDRESS, constant("0xc8CDceCE5d006dAB638029EBCf6Dd666efF5A952")) | |
| .setHeader(TO_ADDRESS, constant("0x484982345fD584a0a16deC5F9ba330f6383af3d9")) | |
| .process(new Processor() { | |
| public void process(Exchange exchange) throws Exception { | |
| int random = rand.nextInt(50); | |
| Function function = new Function("setBTCCap", Arrays.<Type>asList( | |
| new Uint(BigInteger.valueOf(btcPrice))), Collections.<TypeReference<?>>emptyList()); | |
| exchange.getIn().setHeader(DATA, FunctionEncoder.encode(function)); | |
| } | |
| }) | |
| .to("web3j://http://127.0.0.1:7545"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment