Skip to content

Instantly share code, notes, and snippets.

View MagnusSmith's full-sized avatar

Magnus Smith MagnusSmith

View GitHub Profile
@bmaggi
bmaggi / Scratch.java
Last active July 8, 2022 02:34
Transform KafakFuture <-> CompletableFuture
// See https://issues.apache.org/jira/browse/KAFKA-6987 for ongoing work on KafkaFuture implementation of CompletableFuture
private <T> CompletableFuture<T> toCompletableFuture(final KafkaFuture<T> kafkaFuture) {
final CompletableFuture<T> wrappingFuture = new CompletableFuture<>();
kafkaFuture.whenComplete((value, throwable) -> {
if (throwable != null) {
wrappingFuture.completeExceptionally(throwable);
} else {
wrappingFuture.complete(value);
}
});
## Obtain Token and Invoke Service
@MagnusSmith
MagnusSmith / ThirdParty.scala
Created January 22, 2013 13:23
My first attempt to use slick with play framework shows a slick table defined using a case class and a few helper methods to create, find, update and delete records
package models
import scala.slick.driver.H2Driver.simple._
import scala.slick.session.Session
/**
* Created with IntelliJ IDEA.
* User: Magnus.Smith
* Date: 21/01/13
* Time: 16:20