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
import java.time.LocalDateTime; | |
import java.util.Scanner; | |
/** | |
* int/Integer i = 2000 + 2556 = 45.56; | |
* short/Short sh = 20; | |
* long/Long l = 20; | |
* boolean/Boolean = true/false; | |
* String = "texto" | |
* char/Char = 'c' |
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
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.concurrent.*; | |
import java.util.stream.Collectors; | |
class FutureWrapper<T> { | |
Future<T> future; | |
CompletableFuture<T> completableFuture; |
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
import java.util.UUID | |
import akka.Done | |
import akka.actor.{Actor, ActorSystem, Props} | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.server.Directives | |
import akka.stream.{ActorMaterializer, DelayOverflowStrategy} | |
import akka.stream.alpakka.sqs.scaladsl.{SqsAckSink, SqsSource} | |
import com.amazonaws.AmazonWebServiceRequest | |
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration |
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
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.server.{Directives, Route} | |
import akka.stream.ActorMaterializer | |
import scala.concurrent.ExecutionContext | |
abstract class AkkaHttpApp(host: String = "localhost", port: Int = 8080) extends App with Directives { | |
implicit val sys: ActorSystem = ActorSystem() | |
implicit val mat: ActorMaterializer = ActorMaterializer() |
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 utils | |
import akka.NotUsed | |
import akka.stream.FlowShape | |
import akka.stream.scaladsl.{Flow, GraphDSL, Merge, Partition} | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global |
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 utils | |
import java.util.UUID | |
import akka.actor.{Actor, ActorRef, ActorSystem, Props} | |
import akka.util.Timeout | |
import software.amazon.awssdk.services.sqs.SqsAsyncClient | |
import akka.pattern.ask | |
import scala.concurrent.Future |
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
Source | |
.unfoldAsync(1) { page => | |
fetchHttpServicePage(page).map { | |
case Nil => None | |
case list => Some(page + 1, list) | |
} | |
} |
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 main | |
import akka.actor.{Actor, ActorRef, ActorSystem, Props} | |
import akka.http.scaladsl.model.StatusCodes | |
import akka.http.scaladsl.server.{HttpApp, Route} | |
import scala.concurrent.duration._ | |
import akka.pattern._ | |
import akka.util.Timeout | |
import de.heikoseeberger.akkahttpplayjson.PlayJsonSupport |
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
case class EdiLine(field1: String, field2: String, field3: String) | |
object EdiLine { | |
def fromLines(lines: List[String]): List[EdiLine] = { | |
lines.map { line => | |
EdiLine(line.substring(0, 10), line.substring(11, 15), line.substring(16, 20)) | |
} | |
} | |
def fromFile(fileName: String): List[EdiLine] = { |
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
import library.* | |
import library.headers.* | |
import library.json.* | |
class OrderControllerV1(repository: OrderRepository): | |
@get( | |
description = "Fetch user by id", | |
path = "/api/v1/orders/{orderId}", | |
produces = "application/json" | |
) |