Don't fork me!

Introduction

docker / docker-compose
./mvnw
increment maven version
./mvnw build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false

Resources:

Implementation

app

build, run and test
./mvnw clean install -f ./subzero-kryo-app/pom.xml
./subzero-kryo-app/subzero-kryo-app-backend/target/*.jar &
http :8080 ololo=trololo
http :8080 hoho=oho
http :8080

pub-sub

config
  public static final HazelcastInstance instance = createInstance();
  public static final HazelcastInstance client = createClient();
publisher
    final String topicName = "domainEventsTopic";
    final HazelcastInstance client = Hz.client;
    final Function<String, ITopic<DomainEvent>> topic = client::getTopic;
    final Function<String, DomainEvent> data = message -> DomainEvent
        .builder()
        .createdAt(LocalDateTime.now())
        .type(DomainEvent.Type.NONE)
        .jsonData(JSON.stringify(singletonMap("message", message)))
        .build();

    if (args.length > 0) {
      final String message = String.join("", args);
      topic.apply(topicName)
           .publish(data.apply(message));
    }
subscriber
@Slf4j
@Configuration
class PubSubHzCfg {
  @Bean(name = "hzInstance", destroyMethod = "shutdown")
  HazelcastInstance hzInstance() {
    return Hz.instance;
  }

  @Bean(name = "domainEventsTopic")
  ITopic<DomainEvent> domainEventsTopic(@Qualifier("hzInstance") final HazelcastInstance hzInstance) {
    return hzInstance.getTopic("domainEventsTopic");
  }

  @Bean
  ApplicationRunner applicationRunner(@Qualifier("domainEventsTopic") final ITopic<DomainEvent> domainEventsTopic) {
    return args -> domainEventsTopic.addMessageListener(
        message -> log.info("received message: {}",
                            message.getMessageObject(),
                            message.getPublishingMember(),
                            new Date(message.getPublishTime())));
  }
}

kryo (subzero)

config
  public static final Config config = createConfig();

  private static Config createConfig() {
    final Config config = new Config();
    SubZero.useAsGlobalSerializer(config);
    return config;
  }
entity
@Value
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
public class DomainEvent /* implements Serializable */ {
  public enum Type {
    NONE
  }

  // we don't need any serialization, because SubZero Kryo was added globally
  // // private static final long serialVersionUID = -3158689686565990234L;
  @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:s")
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  @JsonSerialize(using = LocalDateTimeSerializer.class)
  final LocalDateTime createdAt;
  final Type type;
  final String jsonData;
}
./mvnw clean install -f ./subzero-kryo-app/pom.xml
./subzero-kryo-app/subzero-kryo-app-backend/target/*.jar &
http :8080 ololo=trololo
http :8080 hoho=oho
http :8080

Unresolved directive in index.adoc - include::../xml.adoc[tags=content] Unresolved directive in index.adoc - include::../xml-sharing.adoc[tags=content] Unresolved directive in index.adoc - include::../xml-async-pipeline.adoc[tags=content]

TODO: implement documentation…​