- Microservice Architecture & Pattern With Java Spring Cloud / Bood
- [RabbitMQ & Java (Spring Boot) for System Integration][6]
- [Apache Kafka With Java Spring Boot-Theory & Hands On Coding][3]
- [REST API Design, Management, Monitoring & Analytics][4]
- [Practical Java : Spring Boot REST API with Elasticsearch][5]
- A Journey : Digital Transformation & Strategy Roadmap
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
// Create Direct Exchange using individual methods | |
import org.springframework.amqp.core.Binding; | |
import org.springframework.amqp.core.BindingBuilder; | |
import org.springframework.amqp.core.DirectExchange; | |
import org.springframework.amqp.core.Queue; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration |
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
// Create Fanout Exchange using single method that return `Declarables` | |
import org.springframework.amqp.core.Binding; | |
import org.springframework.amqp.core.Binding.DestinationType; | |
import org.springframework.amqp.core.Declarables; | |
import org.springframework.amqp.core.FanoutExchange; | |
import org.springframework.amqp.core.Queue; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; |
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
// Create Topic Exchange using single method that return `Declarables` | |
import org.springframework.amqp.core.Binding; | |
import org.springframework.amqp.core.Binding.DestinationType; | |
import org.springframework.amqp.core.Declarables; | |
import org.springframework.amqp.core.Queue; | |
import org.springframework.amqp.core.TopicExchange; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; |
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
// How to use `BindingBuilder` | |
import org.springframework.amqp.core.Binding; | |
import org.springframework.amqp.core.BindingBuilder; | |
import org.springframework.amqp.core.DirectExchange; | |
import org.springframework.amqp.core.FanoutExchange; | |
import org.springframework.amqp.core.Queue; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; |
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
// Create RabbitMQ schema from consumer, using @RabbitListener | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.amqp.core.ExchangeTypes; | |
import org.springframework.amqp.rabbit.annotation.Exchange; | |
import org.springframework.amqp.rabbit.annotation.Queue; | |
import org.springframework.amqp.rabbit.annotation.QueueBinding; | |
import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
import org.springframework.stereotype.Service; |
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
public class ListenerSample { | |
// Adjust the header name if required, on @Header parameter | |
@RabbitListener(queues = "q.finance.invoice") | |
public void listenInvoiceCreated(@Payload String message, @Header(AmqpHeaders.DELIVERY_TAG) long tag, | |
@Header("type") String type) throws IOException { | |
if (StringUtils.equalsIgnoreCase(type, "invoice.paid")) { | |
log.info("Delegate to invoice paid handler"); | |
} else if (StringUtils.equalsIgnoreCase(type, "invoice.created")) { | |
log.info("Delegate to invoice created handler"); |
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
import org.springframework.amqp.core.Message; | |
import org.springframework.amqp.core.MessagePostProcessor; | |
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; | |
import org.springframework.amqp.rabbit.connection.ConnectionFactory; | |
import org.springframework.amqp.rabbit.core.RabbitTemplate; | |
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; | |
import org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; |
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
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.amqp.core.Message; | |
import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
import org.springframework.stereotype.Service; | |
import com.course.finance.message.invoice.InvoiceCreatedMessage; | |
import com.course.finance.message.invoice.InvoicePaidMessage; |
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
{"tenant_name":"Jogja Chocolate","registered_date":"2018-04-21","buildings":[{"address":"107 Diponegoro Street","type":"Warehouse","size":4000,"occupied":true},{"address":"52 Arjuna Street","type":"Store","size":300,"occupied":true},{"address":"94 Malioboro Street","type":"Store","size":250,"occupied":true}]} | |
{"tenant_name":"Merapi Batik","registered_date":"2015-02-18","buildings":[{"address":"52 Kaliurang Street","type":"Store","size":800,"occupied":true},{"address":"255 Solo Street","type":"Store","size":400,"occupied":false}]} |
OlderNewer