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
# app/consumers/hello_consumer.rb | |
class HelloConsumer < Racecar::Consumer | |
subscribes_to "some-topic" | |
def process(message) | |
puts "Received message: #{message.value}" | |
end | |
end |
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 Consumer | |
class Fetcher | |
def initialize(input, output) | |
@input, @output = input, output | |
@running = true | |
end | |
def run | |
while @running |
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 IoFuture | |
def initialize(io, &block) | |
@io, @block = io, block | |
end | |
def to_io | |
@io | |
end | |
def value |
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
module SearchQueryIndexer exposing (main) | |
import Stream exposing (Stream, Pipeline) | |
main : Pipeline | |
main = | |
Stream.readFrom "searches" | |
|> Stream.filter (\search -> search.resultCount > 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
module Kafka.Consumer where | |
import Kafka | |
type alias Config = | |
{ groupId : String | |
, checkpointInterval : Maybe Int | |
, checkpointThreshold : Maybe Int | |
, heartbeatInterval : Int | |
} |
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
module Aggregate exposing (..) | |
type alias Aggregate cmd error event state = | |
{ init : state | |
, apply : event -> state -> state | |
, handle : cmd -> state -> Result error event | |
} | |
type alias Coder cmd event = | |
{ decodeEvent : String -> Result String event |
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
impressions : Stream (ImpressionId, Impression) | |
clicks : Stream (ImpressionId, Click) | |
-- One element per key with lists of input elements. | |
matches : Stream (ImpressionId, (List Impression, List Click)) | |
matches = | |
Stream.join impressions clicks | |
-- One element per input-pair match. | |
matches : Stream (ImpressionId, (Impression, Click)) |
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
module Foosball.Game exposing (..) | |
type Team = BlueTeam | RedTeam | |
type alias Player = String | |
type alias Score = Int | |
type Event | |
= PlayerAdded { team : Team, player : Player } | |
| PlayerRemoved { player : Player } | |
| ScoreAdded { team : Team, score : Score } |
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
module Kafka exposing (..) | |
type alias KafkaRecord = | |
{ topic : String | |
, partition : Int | |
, offset : Int | |
, key : Maybe String | |
, value : Maybe String | |
} |
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
module Kafka exposing (..) | |
import Stream exposing (Source, Sink) | |
source : String -> Source String String | |
sink : String -> Sink String String |