title |
---|
Elements of Messaging and Eventing Platforms |
This document provides a brief overview of the essential elements of a messaging and eventing platform and how they relate to each other.
## | |
# Application configuration | |
## | |
samples.aws.sqs.consumer-queue: customersCreatedQueue | |
## | |
# Spring Cloud AWS | |
## | |
cloud: | |
aws: |
import org.slf4j.LoggerFactory | |
import org.springframework.jdbc.core.JdbcTemplate | |
import org.springframework.stereotype.Component | |
import org.springframework.transaction.annotation.Propagation | |
import org.springframework.transaction.annotation.Transactional | |
import java.time.Duration | |
interface LockManager { | |
fun <T> tryWithLock(key: Long, timeout: Duration, function: () -> T): T | |
} |
@Service | |
public class NaiveJavaSynchronizedATMService { | |
@Autowired | |
private AccountRepository repository; | |
@Transactional | |
public synchronized void withdraw(Long accountId, double amount) { | |
Account account = repository.findById(accountId).orElseThrow(() -> { |
git reset --hard HEAD ; git clean -fd |
-- | |
-- Trying to buy a new ticket for an event | |
-- | |
BEGIN; | |
UPDATE events e | |
SET updated_at = now() | |
WHERE e.id = :event_id | |
AND e.max_tickets > (SELECT count(*) -- (does this logic work with READ_COMMITTED??) | |
FROM tickets t | |
WHERE t.event_id = e.id); |
package br.com.zup.edu.livraria; | |
import org.springframework.boot.test.autoconfigure.web.servlet.MockMvcBuilderCustomizer; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.security.core.authority.SimpleGrantedAuthority; | |
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; | |
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | |
import org.springframework.test.web.servlet.setup.ConfigurableMockMvcBuilder; | |
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.jwt; |
package br.com.zup.edu.minhasfigurinhas; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
import static org.springframework.http.HttpMethod.GET; | |
import static org.springframework.http.HttpMethod.POST; | |
import static org.springframework.security.config.http.SessionCreationPolicy.STATELESS; |
@Entity | |
public class Album { | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
private Long id; | |
@Size(min = 1) | |
@OneToMany(cascade = { |
## | |
# 1. run theses commands on PowerShell as admin | |
# 2. restart windows | |
## | |
wsl --shutdown | |
netsh winsock reset | |
netsh int ip reset all | |
netsh winhttp reset proxy | |
ipconfig /flushdns |