Skip to content

Instantly share code, notes, and snippets.

View mmornati's full-sized avatar

Marco Mornati mmornati

View GitHub Profile
@mmornati
mmornati / default.yaml
Last active December 28, 2021 03:51
default.yaml
# ===================================================================== #
# BASIC CONFIGURATION
# ===================================================================== #
# Arch: "default", "x86_64", "aarch64".
# "default" corresponds to the host architecture.
arch: "default"
# An image must support systemd and cloud-init.
# Ubuntu and Fedora are known to work.
@mmornati
mmornati / MessageConsumer.java
Last active December 8, 2019 22:27
Consume Operation Message
@Component
@RequiredArgsConstructor
public class OperationMessageConsumer {
private static final LoggerService LOGGER = LoggerServiceFactory.getLoggerService(OperationMessageConsumer.class);
private final MyExternalService service;
private static final ObjectMapper MAPPER = new ObjectMapper();
@RabbitListener(id = LISTENER_ID, queues = Queues.OPERATIONS, containerFactory = "rabbitListener")
@mmornati
mmornati / MessageProducer.java
Created December 8, 2019 21:23
Produce Message
@Component
@RequiredArgsConstructor
public class CreateOperationRabbitMessage {
private static final LoggerService LOGGER = LoggerServiceFactory.getLoggerService(CreateOperationRabbitMessage.class);
private final RabbitTemplate rabbitTemplate;
private static final ObjectMapper MAPPER = new ObjectMapper();
@Override
@mmornati
mmornati / EventListener.java
Created December 7, 2019 23:05
Operation Event Lister
@Component
@AllArgsConstructor
public class OperationEventListener {
private final ICreateOperationMessage createOperationMessage;
@TransactionalEventListener
public void processTransactionDetailEvent(OperationEvent event) {
ICreateOperationMessage message = createOperationMessage.createMessage(event.getOperationId());
createOperationMessage.sendMessage(message);
@mmornati
mmornati / sendEvent.java
Created December 7, 2019 23:00
Raise a Sprint ApplicatioEvent in a transactionalContext
private final ApplicationEventPublisher applicationEventPublisher;
@Transactional
public void myTransactionalMethod(Operation operation) {
service.storeOperation(operation);
sendEvent(operation.getId());
}
private void sendEvent(Long operationId) {
OperationEvent event = new OperationEvent(operationId);
@mmornati
mmornati / sendMessage.java
Last active December 7, 2019 22:45
Send message in a Transactional Function
@Transactional
public void myTransactionalMethod(Operation operation) {
service.storeOperation(operation);
sendMessage(operation.getId());
}
private boolean sendMessage(Long operationId) {
try {
String operationJson = objectMapper.writeValueAsString(operation);
Message message = MessageBuilder
@mmornati
mmornati / application.yml
Created December 7, 2019 22:32
Spring-Boot RabbitMQ configuration
spring:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
queues:
x-message-ttl: 240000
@mmornati
mmornati / release_notes_actions_v2.yml
Last active September 13, 2019 20:54
Auto Release Notes generation with GitHub Actions
on: milestone
name: Milestone Closure
jobs:
release-notes:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: action-filter
uses: actions/bin/filter@master
with:
@mmornati
mmornati / main.workflow
Created April 14, 2019 21:35
GitHub Relase Notes generation published into the GitHub wiki
workflow "On Milestone" {
on = "milestone"
resolves = ["mmornati/wiki-page-creator-action@master"]
}
action "action-filter" {
uses = "actions/bin/filter@master"
args = "action closed"
}
@mmornati
mmornati / keybase.md
Created March 1, 2015 12:23
keybase.io activation

Keybase proof

I hereby claim:

  • I am mmornati on github.
  • I am mmornati (https://keybase.io/mmornati) on keybase.
  • I have a public key whose fingerprint is 27FB 2ECF DA19 0EA8 C08B 10AF 448C 35F9 F9B9 9F8A

To claim this, I am signing this object: