Skip to content

Instantly share code, notes, and snippets.

@davideicardi
davideicardi / cloudera-docker.md
Last active April 4, 2024 19:00
Running Cloudera with Docker for development/test
@davideicardi
davideicardi / schema.xml
Last active June 11, 2018 17:09
Basic SolR 4 (Cloudera 5) configurations
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@davideicardi
davideicardi / sbt-multiprojects-guide.md
Last active October 1, 2019 09:31
Scala/sbt minimal multi projects setup

Scala/sbt minimal multi projects setup

Assume that you have the following directory structure:

  • your-app
    • project1
      • src
        • main
          • scala
            • App.scala
@davideicardi
davideicardi / README.md
Last active June 22, 2020 04:39
Alpakka Kafka connector (akka-stream-kafka) example. Produce and consumer kafka messages using Akka Stream.

Alpakka Kafka connector (akka-stream-kafka) example

Simple solution to use Alpakka Kafka connector to produce and consume kafka messages.

I assume that you have 2 scala apps, a producer and a consumer.

Producer

Add the following dependencies:

@davideicardi
davideicardi / README.md
Last active June 26, 2018 13:54
Alpakka HBase connector, write Akka messages to HBase
@davideicardi
davideicardi / PassThroughFlow.scala
Last active June 6, 2022 08:32
Akka stream generic pass through flow. For latest implementation see https://developer.lightbend.com/docs/alpakka/current/patterns.html#passthrough
/*
https://scalafiddle.io/sf/sniohcZ/3
(old version: https://scalafiddle.io/sf/sniohcZ/1)
Use PassThroughFlow when you have a message that should be used in a
flow that trasform it but you want to maintain the original message for
another following flow.
For example if you consume messages from Kafka (CommittableMessage).
You process the message (transform, save it inside a database, ...) and then you need again the original message
to commit the offset.
@davideicardi
davideicardi / ConditionalFlow.scala
Created June 29, 2018 14:09
Conditional Akka Stream Flow
import akka._
import akka.stream._
import akka.stream.scaladsl._
import akka.actor._
// WARNING: Ordering is not guaranteed.
// The problem with this Graph is that when splitting the flow
// we obtain 2 concurrent flows.
// The result of conditionalFlow can returns after another messages is processed in the brodcast.
// ie. If you have 10 messages from 0 to 9. Let's say that we run a conditional flow only for element 0.
@davideicardi
davideicardi / README.md
Last active April 23, 2023 01:13
Gradle minimal multi-projects scala build

Gradle multi-projects scala build

Assume that you have the following directory structure:

  • your-app
    • project1
      • src
        • main
          • scala
  • App.scala
@davideicardi
davideicardi / README.md
Last active January 21, 2019 12:39
VerneMq Kubernetes StatefulSet + LoadBalancer

Deploy VerneMq inside Kubernetes

Allow the default service account to read pods data, by adding a role binding:

TODO: Now the yaml works only for the dev1 namespace, how can I make it more generic?

kubectl apply -f ./add-read-pods-binding.yaml
@davideicardi
davideicardi / README.md
Last active March 8, 2023 15:05
Write and read Avro records from bytes array

Avro serialization

There are 4 possible serialization format when using avro: