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.example.handler; | |
import com.amazonaws.services.lambda.runtime.Context; | |
import com.amazonaws.services.lambda.runtime.RequestHandler; | |
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; | |
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; | |
import com.example.models.Request; | |
import com.example.utils.constant.Constants; | |
import com.example.utils.fileprocessor.FileReader; | |
import com.example.models.Response; |
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 object ujson{ | |
def transform[T](t: Transformable, v: Visitor[_, T]) = t.transform(v) | |
def read(s: Transformable): Js.Value = transform(s, Js) | |
def copy(t: Js.Value): Js.Value = transform(t, Js) | |
def write(t: Js.Value, indent: Int = -1): String = { | |
transform(t, StringRenderer(indent)).toString | |
} |
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
trait Api { | |
def read[T: Reader](s: Transformable): T = s.transform(reader[T]) | |
def readJs[T: Reader](s: Js.Value): T = s.transform(reader[T]) | |
def reader[T: Reader] = implicitly[Reader[T]] | |
def write[T: Writer](t: T, indent: Int = -1): String = { | |
transform(t).to(StringRenderer(indent)).toString | |
} |
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 | |
Description: AWS Lambda Sample Project | |
Resources: | |
Products: | |
Type: AWS::Serverless::Function | |
Properties: | |
Handler: com.example.handler.LambdaHandler |
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
class EmployeeRepository { | |
val cluster = Cluster.builder.addContactPoint("127.0.0.1").build() | |
val session = cluster.connect() | |
val KEYSPACE_TABLE = "CREATE KEYSPACE IF NOT EXISTS udt WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1 };" | |
val ADDRESS_TABLE = "CREATE TYPE IF NOT EXISTS udt.address (employee_id int, residence_address text, office_address text,city text);" | |
val EMPLOYEE_TABLE = "CREATE TABLE IF NOT EXISTS udt.employee (employee_id int PRIMARY KEY,name text,address frozen<address>,salary text);" | |
session.execute(KEYSPACE_TABLE) | |
session.execute(ADDRESS_TABLE) | |
session.execute(EMPLOYEE_TABLE) |
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
import com.crankuptheamps.client.Client; | |
import com.crankuptheamps.client.exception.AMPSException; | |
object Publisher extends App { | |
val client = new Client("MyClient") | |
try { | |
client.connect("tcp://127.0.0.1:9007/amps/json") | |
client.logon() | |
client.publish("messages", "{ \"message\" : \"Hello, world!\" } ") |
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
import com.crankuptheamps.client.Client; | |
import com.crankuptheamps.client.exception.AMPSException; | |
import scala.collection.JavaConverters._ | |
object Subscriber extends App { | |
val client = new Client("subscribe") | |
try { | |
client.connect("tcp://127.0.0.1:9007/amps/json") |
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
<SOW> | |
<Topic> | |
<Name>sow-topic</Name> | |
<FileName>sow/%n.sow</FileName> | |
<Expiration>enabled</Expiration> | |
<Key>/id</Key> | |
<MessageType>json</MessageType> | |
</Topic> | |
</SOW> |
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
import akka.actor.Props | |
import akka.persistence.{PersistentActor, SnapshotOffer} | |
import com.knoldus.models._ | |
import com.knoldus.persistence.CounterPersistentActor.Response | |
class CounterPersistentActor(id: String) extends PersistentActor { | |
override val persistenceId: String = id | |
var state = State(count = 0) |
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
import cats.syntax.option._ | |
val optionValue: Option[Int] = 35.some | |
val noneValue: Option[Int] = none[Int] |
OlderNewer