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
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Parameters: | |
StageName: | |
Type: String | |
Default: dev | |
AllowedValues: | |
- dev | |
- staging |
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
serverless create \ | |
--template-url https://github.com/bytekast/serverless-toolkit/tree/master/templates/java-springboot-monolith \ | |
--path my-springboot-service | |
cd my-springboot-service | |
./gradlew clean build # build | |
./gradlew bootRun # run locally | |
curl http://localhost:8080/greeting # test locally | |
serverless deploy # deploy |
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
task(buildJson) { | |
doLast { | |
new File("$buildDir/build.json").newWriter().withWriter { w -> | |
w << JsonOutput.toJson([distribution: relativePath(jar.archivePath), version: jar.version]) | |
} | |
} | |
} | |
jar.finalizedBy buildJson |
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
serverless create \ | |
--template-url https://github.com/bytekast/serverless-templates/tree/master/microservice-starter \ | |
--path myservice |
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
package com.stedi.platform.lambda | |
import com.amazonaws.services.lambda.runtime.Context | |
import groovy.transform.CompileStatic | |
import groovy.util.logging.Slf4j | |
import org.codehaus.groovy.runtime.StackTraceUtils | |
@Slf4j | |
@CompileStatic | |
abstract class AbstractEventHandler implements CommonTrait, AmazonSNSTrait, DataDogTrait, SentryTrait { |
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
final successHandler = { controller.successEvent(context, transmissionUuid, parcel) } | |
final errorHandler = { Exception e -> controller.errorEvent(context, transmissionUuid, parcel, e) } | |
task { controller.download(sessionId, parcel) } | |
.then { download -> controller.save(download, transmissionUuid, parcel) } | |
.then { download -> controller.forward(download, transmissionUuid, parcel) } | |
.then { controller.delete(sessionId, parcel.id) } | |
.then(successHandler, errorHandler) |
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
apply plugin: 'groovy' | |
repositories { | |
jcenter() | |
mavenCentral() | |
} | |
dependencies { | |
compile( | |
'org.codehaus.groovy:groovy-all:2.4.7', |
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: user-service | |
provider: | |
name: aws | |
runtime: java8 | |
memorySize: 1536 | |
timeout: 60 | |
package: | |
artifact: build/distributions/user-service.zip |
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
package com.serverless | |
import com.amazonaws.services.lambda.runtime.Context | |
import com.amazonaws.services.lambda.runtime.RequestHandler | |
import io.vertx.core.AbstractVerticle | |
import io.vertx.core.Vertx | |
import java.util.concurrent.CompletableFuture | |
import java.util.concurrent.TimeUnit |
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
@SpringBootApplication | |
@ComponentScan | |
@Log4j | |
class VertxLambdaHandler implements RequestHandler<Map, Response> { | |
static void main(String[] args) throws Exception { | |
LambdaHandler.newInstance().getApplicationContext(args) | |
} | |
@Memoized |
NewerOlder