Articles

Mise en œuvre de la découverte de services avec Spring Cloud (2e partie)

Dans cette deuxième partie, nous allons voir comment mettre en œuvre la découverte de services avec Spring Cloud. Préparez-vous à apprendre comment configurer et déployer vos services !

Partie 2 de l’Article Spring Cloud: Comment Implémenter le Service Discovery (Partie 1)

Dans la première partie de cet article, Spring Cloud: Comment implémenter le service de découverte (Partie 1), nous avons vu les bases du Service Discovery dans le contexte de Spring Cloud. Nous avons vu que la composante Netflix OSS Eureka est toujours le choix principal. Dans ce post, nous allons discuter de certains sujets supplémentaires liés à Eureka, tels que :

API Java Client

API REST

Sécuriser le serveur de découverte et les services clients

Combiner le Service Discovery avec la Configuration Distribuée

Service Discovery : API Java Client

Dans les exemples de la première partie de cet article, l’enregistrement et le récupération des fonctionnalités étaient exécutés sous le capot et nous avons seulement vu les résultats des tests de l’architecture entière en appelant un point de terminaison REST client. Il existe également une manière d’interagir avec l’API Eureka de manière programmatique, en utilisant des appels de méthodes Java. Un choix possible serait d’utiliser la classe EurekaClient. Par exemple, si nous voulons obtenir toutes les instances d’un service identifié par un ID particulier, nous pourrions écrire le code suivant, supposant que nous avons un client implémenté comme une application Spring Boot exposant des services REST :

EurekaClient eurekaClient = new EurekaClient.Builder().build();

Applications applications = eurekaClient.getApplications(« SERVICE_ID »);

List instances = applications.getInstances();

Une fois que nous avons obtenu la liste des instances, nous pouvons parcourir cette liste et récupérer les informations dont nous avons besoin, telles que l’adresse IP et le port sur lesquels le service est en cours d’exécution. Nous pouvons également effectuer des opérations supplémentaires sur les instances, telles que la mise à jour des informations ou la suppression d’une instance.

Service Discovery : API REST

Eureka fournit également une API REST qui peut être utilisée pour interagir avec le serveur de découverte. Cette API est très similaire à l’API Java client, mais elle est plus adaptée aux scénarios où nous devons interagir avec le serveur de découverte depuis un environnement non-Java ou depuis un script. Par exemple, si nous voulons récupérer toutes les instances d’un service spécifique, nous pouvons appeler l’URL suivante :

http://:/eureka/apps/

Cette URL retournera une réponse JSON contenant toutes les informations relatives à ce service et à ses instances. Nous pouvons également effectuer des opérations supplémentaires sur les instances, telles que la mise à jour des informations ou la suppression d’une instance, en appelant des URL spécifiques.

Service Discovery : Sécurisation du serveur et des services clients

Enfin, il est important de noter que le serveur Eureka et les services clients doivent être sécurisés pour éviter toute attaque malveillante. Par exemple, nous pouvons configurer Eureka pour utiliser HTTPS pour sécuriser les communications entre le serveur et les clients. Nous pouvons également configurer Eureka pour authentifier les clients et leurs requêtes en utilisant un système d’authentification basé sur des jetons. De plus, il est possible de configurer Eureka pour

Source de l’article sur DZONE

Two of the most popular message brokers used today are Kafka and those based around JMS. JMS is a long-standing Java API used generally for developing messaging applications, with its primary function of being able to send messages between two or more clients. Kafka, on the other hand, is a distributed streaming platform that provides a lot of scalabilities and is useful for real-time data processing. 

While both offer their own advantages and are highly useful in their own right, which of the two should you be actually using?

Source de l’article sur DZONE

‘java.lang.System.getProperty()’ is a common API used by Java developers to read the System properties that are configured during application startup time. i.e. when you pass “-DappName=buggyApp” as your application’s startup JVM argument, the value of the ‘appName’ system property can be read by invoking the ‘java.lang.System.getProperty()’. Example:

Java

 

public static String getAppName() { String app = System.getProperty("appName");   return app;
}

Source de l’article sur DZONE

A domain name is used to represent online entities and provide users with access to websites that can help them accomplish goals like purchasing products, finding information, and connecting with others. As the internet a tool universally used in commerce throughout business practices, it is important to know what sites you are accessing, as well as any threats that may exist from those domains. 

With phishing attempts and other cyber threats on the rise, online security should be a key part of business planning. Preparing for these risks will help prevent the theft of information and protect your organization and client-base. Having a plan in place will lend your business credibility and reliability in the eyes of your users and partners, who will know that they can trust you with their sensitive data.

Source de l’article sur DZONE

As we have discussed before, the PDF is the ideal file format for saving, sharing, and protecting documents, both small and large. Its high compatibility with most Operating Systems makes it popular amongst most users for sharing information with different parties. Furthermore, it provides a more static platform for working with important documents like contracts and manuals, as steps can be taken to prevent any unwanted access or editing to the file. 

With large and highly complex files like this, however, different systems may have difficulty uploading, downloading, and reading the formatting for your document. This can lead to file corruption or increased loading times that can halt productivity. Thus, streamlining large PDF files can greatly benefit organizations that regularly use this format in day-to-day operations. 

Source de l’article sur DZONE


Java 8
No matter what version of the JDK we are on, Java 8 is not going anywhere.

Java 8 introduced a new era of Java. Everything from lambda expressions and functional programming to Streams and collections — DZone was there to document it all.

So whether you’re migrating over to Java 9 or Java 11, or maybe even Java 13, Java 8 concepts and features are still very much alive in the JDK. And understanding these core concepts can help tremendously when it’s time to move beyond Java 8.

Source de l’article sur DZONE