Skip to content

Instantly share code, notes, and snippets.

View robsonkades's full-sized avatar
🎯
Focusing

Robson Kades robsonkades

🎯
Focusing
View GitHub Profile
import org.springframework.web.client.RestClient;
public record WebServiceClient(RestClient restClient, CloseableResources closeableResources) {
}
import org.springframework.http.ResponseEntity;
import java.util.concurrent.CompletableFuture;
public interface WebService {
@RestController
@RequestMapping
public class MessageController {
private final AzureServiceBusTemplate serviceBusTemplate;
public MessageController(AzureServiceBusTemplate azureServiceBusTemplate) {
this.serviceBusTemplate = azureServiceBusTemplate;
}
@PostMapping
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import java.time.Duration;
spring:
application:
name: agendador-distribuido
datasource:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver #org.postgresql.Driver
password: ${SQL_PASSWORD:Sqlserver!@#} #postgres
url: ${SQL_JDBC:jdbc:sqlserver://localhost:1433;encrypt=false;databaseName=master;encrypt=true;trustServerCertificate=true;sendStringParametersAsUnicode=false;ApplicationName=App} #jdbc:postgresql://localhost:5432/postgres
username: sa #postgres
hikari:
connection-timeout: 250 # É uma configuração em milliseconds. O ideal é manter baixo para que estoure timeout logo e não prenda as threads.
spring.quartz.auto-startup=true
spring.quartz.job-store-type=jdbc
spring.quartz.jdbc.initialize-schema=never
spring.quartz.startup-delay=30s
spring.quartz.wait-for-jobs-to-complete-on-shutdown=true
spring.threads.virtual.enabled=true
logging.level.org.quartz=DEBUG
spring.quartz.scheduler-name=quartzScheduler
spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO
spring.quartz.properties.org.quartz.jobStore.useProperties=true
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.XMLConstants;
import javax.xml.crypto.AlgorithmMethod;
import javax.xml.crypto.KeySelector;
import javax.xml.crypto.KeySelectorException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.XMLConstants;
import javax.xml.crypto.AlgorithmMethod;
import javax.xml.crypto.KeySelector;
import javax.xml.crypto.KeySelectorException;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
factory.setNamespaceAware(true);
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
factory.setFeature("http://xml.org/sax/features/namespaces", true);
factory.setAttribute("http://javax.xml.XMLConstants/property/accessExternalDTD", "");
factory.setAttribute("http://javax.xml.XMLConstants/property/accessExternalSchema", "");
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>