Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
package models.error | |
import org.scalactic._ | |
import scala.concurrent.{ExecutionContext, Future} | |
import org.scalactic.Accumulation._ | |
import scala.util.Success | |
trait Error |
import akka.actor.ActorRef; | |
import akka.dispatch.*; | |
import org.jctools.queues.MpscArrayQueue; | |
/** | |
* Non-blocking, multiple producer, single consumer high performance bounded message queue, | |
* this implementation is similar but simpler than LMAX disruptor. | |
*/ | |
public final class MpscBoundedMailbox implements MessageQueue { |
In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.
At the moment GraphQL allows 2 types of queries:
query
mutation
Reference implementation also adds the third type: subscription
. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.
A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)
I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.
A functor is something that supports map
.
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.marshalling.{Marshaller, ToResponseMarshaller} | |
import akka.http.scaladsl.model.HttpEntity.ChunkStreamPart | |
import akka.http.scaladsl.model.{HttpEntity, HttpResponse, MediaTypes} | |
import akka.http.scaladsl.server.Directives._ | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.Source | |
package com.boldradius.auction.cqrs | |
import akka.actor._ | |
import akka.contrib.pattern.ShardRegion | |
import akka.contrib.pattern.ShardRegion.Passivate | |
import akka.persistence.{RecoveryCompleted, PersistentActor, SnapshotOffer, Update} | |
import com.boldradius.auction.AuctionProtocol._ | |
import com.boldradius.auction.domain.{AuctionBidState, Bid} | |
import com.boldradius.util.AuctionLogging |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
sealed trait Interact[A] | |
case class Ask(prompt: String) | |
extends Interact[String] | |
case class Tell(msg: String) | |
extends Interact[Unit] | |
trait Monad[M[_]] { | |
def pure[A](a: A): M[A] |