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
| package com.bakdata.kafka; | |
| import java.util.Properties; | |
| import org.apache.kafka.common.serialization.Serdes.StringSerde; | |
| import org.apache.kafka.streams.KafkaStreams; | |
| import org.apache.kafka.streams.StreamsBuilder; | |
| import org.apache.kafka.streams.StreamsConfig; | |
| import org.apache.kafka.streams.Topology; | |
| import org.apache.kafka.streams.kstream.KStream; |
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
| package com.bakdata.kafka; | |
| import java.util.Map; | |
| import java.util.Properties; | |
| import org.apache.kafka.common.serialization.Serde; | |
| import org.apache.kafka.common.serialization.Serdes; | |
| import org.apache.kafka.common.serialization.Serdes.StringSerde; | |
| import org.apache.kafka.streams.KafkaStreams; | |
| import org.apache.kafka.streams.StreamsBuilder; | |
| import org.apache.kafka.streams.StreamsConfig; |
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
| package com.bakdata.kafka; | |
| import static org.assertj.core.api.Assertions.assertThat; | |
| import com.bakdata.fluent_kafka_streams_tests.junit5.TestTopologyExtension; | |
| import com.google.common.collect.Lists; | |
| import java.util.Properties; | |
| import org.apache.kafka.common.serialization.Serdes.IntegerSerde; | |
| import org.apache.kafka.common.serialization.Serdes.StringSerde; | |
| import org.apache.kafka.streams.StreamsBuilder; |
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
| aws lambda invoke --function-name r-matrix-example \ | |
| --region eu-central-1 response.txt | |
| cat response.txt | |
| # {"result":[4,5,6]} |
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
| chmod 755 matrix.r | |
| zip function.zip matrix.r | |
| aws lambda create-function --function-name r-matrix-example \ | |
| --zip-file fileb://function.zip --handler matrix.handler \ | |
| --runtime provided --timeout 60 --memory-size 3008 \ | |
| --layers arn:aws:lambda:eu-central-1:131329294410:layer:r-runtime:10 \ | |
| arn:aws:lambda:eu-central-1:131329294410:layer:r-recommended:1 \ | |
| --role <role-arn> --region eu-central-1 |
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
| aws lambda invoke --function-name r-example \ | |
| --payload '{"x":1}' --region eu-central-1 response.txt | |
| cat response.txt | |
| # {"result":2} |
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
| chmod 755 script.r | |
| zip function.zip script.r | |
| aws lambda create-function --function-name r-example \ | |
| --zip-file fileb://function.zip --handler script.increment \ | |
| --runtime provided --timeout 60 \ | |
| --layers arn:aws:lambda:eu-central-1:131329294410:layer:r-runtime:10 \ | |
| --role <role-arn> --region eu-central-1 |
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
| library(Matrix) | |
| handler <- function() { | |
| return(Matrix(1:6, 3, 2)[, 2]) | |
| } |
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
| library(httr) | |
| library(jsonlite) | |
| HANDLER <- Sys.getenv("_HANDLER") | |
| AWS_LAMBDA_RUNTIME_API <- Sys.getenv("AWS_LAMBDA_RUNTIME_API") | |
| args = commandArgs(trailingOnly = TRUE) | |
| EVENT_DATA <- args[1] | |
| REQUEST_ID <- args[2] | |
| HANDLER_split <- strsplit(HANDLER, ".", fixed = TRUE)[[1]] |
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
| #!/bin/sh | |
| set -euo pipefail | |
| # Processing | |
| while true | |
| do | |
| HEADERS="$(mktemp)" | |
| # Get an event | |
| EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET \ |
NewerOlder