Étapes pour travailler avec Spring Integration,en

Spring Integration

Étapes pour travailler avec Spring Integration,en

Vue d'ensemble

Spring integration can solve many problems faced at the enterprise integration levels. When enterprise applications aim to interact with one another, they can face various problems such as technology incompatibility, communication problems and data parsing or conversion problems. Solving such problems can take a lot of resources which could potentially have been invested in more productive work. Spring integration solves such problems and allows enterprises to focus on more important tasks. Spring integration, which owes its origins to the open source spring framework commissioned by SpringSource, leverages a lot of its capabilities from Spring Framework. Though there is an argument that Spring Framework can solve enterprise integration problems that is not true.








What is Spring Integration?

L'intégration Spring est un framework utilisé pour intégrer différents services afin de constituer une solution métier.,,en,Les différents services sont faiblement couplés et basés sur les besoins de l'entreprise,,en,pourrait être changé,,en,La possibilité de modifier facilement les services est une caractéristique déterminante de l’architecture Spring.,,en,Dans une solution métier où l'intégration de Spring est impliquée,,en,la couche d'intégration de service est située immédiatement au-dessus de la couche de service,,en,L’architecture d’intégration de Spring suit l’approche populaire des filtres et des tuyaux,,en,Vous pouvez considérer les filtres comme des unités de traitement de l’information et les canaux comme des conduits d’information.,,en,Genèse de l'intégration printanière,,en,On peut dire que l’inspiration derrière Spring Integration réside dans les divers modèles qui se dégagent lors de la tentative d’intégration d’applications d’entreprise.,,en. The different services are loosely coupled and based on business requirements, could be changed. The ability to modify services easily is a defining feature of the Spring architecture. In a business solution where the Spring integration is involved, the service integration layer is located immediately above the service layer.

The Spring integration architecture follows the popular pipes and filters approach. You can think of the filters as information processing units and the pipes as the conduits of information.

Genesis of Spring Integration

The inspiration behind Spring Integration can be said to be the various patterns that emerge when enterprise application integration is attempted. La clé d'une intégration réussie réside dans la compréhension et la mise en œuvre réussie des modèles,,en,Bien qu'il y ait des opinions que l'intégration de Spring était inutile car le cadre de Spring a le potentiel de mettre en œuvre les modèles,,en,le fait est que la structure Spring fournit uniquement les éléments de base pour la création d'applications d'entreprise et que l'intégration Spring est spécifiquement conçue pour implémenter les modèles,,en,si vous créez une application de messagerie à l'aide de l'intégration Spring,,en,penser aux tuyaux et aux filtres en tant que canaux de messages et points de terminaison de messages,,en,Le réseau achemine des messages d’un point de terminaison à un autre via des canaux,,en,Le message est validé,,en,acheminé,,en,consolidée,,en,séquences réarrangées,,en,reformaté et analysé et enrichi à mesure que les différents points de terminaison traitent les données,,en. Though there are opinions that Spring integration was unnecessary because the Spring Framework has the potential to implement the patterns, the fact is that Spring framework provides just the building blocks for building enterprise applications and Spring integration is specifically meant to implement the patterns. For example, if you build a messaging application with the help of Spring integration, think of the pipes and filters as message channels and message endpoints. The network is carrying messages from one endpoint to another endpoint through channels. The message is validated, routed, Divisé, consolidated, sequences re-arranged, reformatted and parsed and enriched as the different endpoints process the data.

Pourquoi Spring Integration est-il nécessaire?,,en,Il existe un avis selon lequel le framework Spring est capable d’intégration d’applications d’entreprise en raison de son large éventail de fonctionnalités.,,en,le cadre de printemps,,en,pour toutes ses capacités,,en,est incapable de résoudre les problèmes d'intégration d'entreprise uniques,,en,Il est destiné à offrir des blocs de construction pour le développement d'applications d'entreprise,,en,Intégrer diverses applications d'entreprise,,en,vous devez être capable de capturer les différents modèles uniques et de résoudre les problèmes,,en,Laissez-nous comprendre cela avec un exemple,,en,Supposons que deux applications,,en,A et B doivent partager des données entre eux,,en,L'application A peut communiquer avec des applications externes uniquement via une connexion TCP directe, tandis que l'application B utilise un simple service Web pour accepter les rapports.,,en?

There is an opinion that Spring framework is capable of enterprise application integration because of its wide array of capabilities. Cependant, the Spring framework, for all its capabilities, is unable to address the unique enterprise integration problems. It is meant to offer building blocks for enterprise application development. To integrate diverse enterprise applications, you need to be able to capture the different unique patterns and solve the problems. Let us understand this with an example.








Let us assume that two applications, A and B need to share data between them. Application A can communicate with external applications only through a direct TCP connection while application B uses a simple web service for accepting reports. Évidemment, les méthodes de partage et d'acceptation de l'information sont différentes,,en,Réconcilier,,en,vous devez probablement faire plusieurs choses, comme écrire un code et le faire écrire périodiquement,,en,mettre en place un traitement par lots,,en,et analyser les données dans un format compris par l'application B,,en,Faire de telles tâches représente beaucoup d'investissement,,en,Chacune des tâches requises pour intégrer les applications A et B pourrait être externalisée vers une application capable,,en,Chacune de ces tâches peut être effectuée par l'intégration Spring.,,en,L'intégration de Spring peut offrir un framework ou une bibliothèque qui connecte un TCP et des flux de lecture et d'écriture.,,en,Spring Integration offre des services pour intégrer de manière complète les applications d'entreprise.,,en,quelle que soit la technologie ou la plateforme,,en,cela économise beaucoup d'investissements inutiles de la part de l'entreprise,,en,Comment fonctionne Spring Integration?,,en. To reconcile, you need to do probably several things such as writing a code and have it write periodically, set up a batch process, and parse the data to a format that application B understands. Doing such tasks means a lot of investment. Each of the tasks required to integrate application A and B could be outsourced to a capable application. Each of these tasks can be done by Spring integration. For example, Spring integration can offer a framework or library that connects a TCP and reading and writing streams.

In a nutshell, Spring integration offers services to comprehensively integrate enterprise applications, irrespective of the technology or platform. Secondly, it saves a lot of unnecessary investments on the part of the enterprise.

How does Spring Integration work?

Le fonctionnement du framework d'intégration Spring est expliqué ci-dessous,,en,L’image suivante montre les composants d’un message Spring typiques et le flux de messages entre le producteur et le consommateur.,,en,C'est la forme la plus simple de message et de flux de messages,,en,Cela peut être plus compliqué en fonction du type d'exigence,,en,L'architecture de Spring peut fonctionner avec n'importe quelle solution d'entreprise, indépendamment de leur technologie et de leur plate-forme.,,en,L'ensemble de l'infrastructure est une architecture flexible pouvant être configurée de manière dynamique dans une solution d'entreprise.,,en,L'architecture Spring est particulièrement utile dans le contexte de la gestion d'une architecture de microservices ou de solutions ayant couplé de manière lâche plusieurs services dans la couche de services.,,en,Lorsque vous devez désengager un ou plusieurs services de l'architecture,,en,il est facile à gérer avec les capacités d'intégration de Spring,,en. The following image shows a typical Spring message components and message flow between producer and consumer. This is the simplest form of message and message flow. It can be more complicated based on the type of requirement.

  • Spring architecture can work with any business solution irrespective of their technology and platform. The entire framework is a flexible architecture which can be dynamically configured in a business solution.
  • Spring architecture is especially useful in the context of managing microservices architecture or solutions that have loosely coupled multiple services in the service layer. When you need to disengage one or more services from the architecture, it is easily manageable with the Spring integration capabilities.
  • L’intégration de Spring gère l’ensemble des activités d’intégration,,en,Voici un code de gestionnaire de messages typique pour les messages XMPP,,en,Ceci est pour le flux de messages sortant,,en,Il effectue également la partie traitement du message,,en,Affichage du gestionnaire de message,,en,@ServiceActivator,,en,inputChannel =,,en,canal d'entrée,,en,public MessageHandler sendChatMsgHandlr,,en,XMPPConnection xmppConn,,en,ChatMessageSendingMessageHandler handlr = new ChatMessageSendingMessageHandler,,en,xmppConn,,en,DefaultXmppHeaderMapper xmppHdrMpr = new DefaultXmppHeaderMapper,,en,xmppHdrMpr.setRequestHeaderNames,,en,Tester,,en,handlr.setHeaderMapper,,en,xmppHdrMpr,,en,retour handlr,,en,De même, le flux de messages entrants peut être effectué à l'aide de composants de scrutation et d'écoute,,en,La configuration du poller peut être effectuée par SourcePollingChannelAdapter,,en,qui est une autre implémentation de AbstractEndpoint,,en,Voici un exemple de configuration du flux entrant,,en,Exemple de code pour le flux entrant,,en.









Implementation:

Following is a typical message handler code for XMPP messages. This is for outbound message flow. It also performs the processing part of the message.

Listing 1: Showing message handler

@Haricot

@ServiceActivator(inputChannel = “inputchannel”)

public MessageHandler sendChatMsgHandlr(XMPPConnection xmppConn) {

ChatMessageSendingMessageHandler handlr = new ChatMessageSendingMessageHandler(xmppConn);

DefaultXmppHeaderMapper xmppHdrMpr = new DefaultXmppHeaderMapper();

xmppHdrMpr.setRequestHeaderNames(“Test”);

handlr.setHeaderMapper(xmppHdrMpr);

return handlr;

}

Similarly the inbound message flow can be made using polling and listening components. The poller configuration can be done by SourcePollingChannelAdapter, which is another AbstractEndpoint implementation.

Following is a sample configuration of inbound flow.

Listing 2: Sample code for inbound flow

@Haricot

@InboundChannelAdapter,,en,inboundChannel,,en,borne = @ borne,,de,fixedDelay =,,en,public MessageSource,,fr,stockéeProc,,en,DataSource dtaSrc,,en,retourne le nouveau JdbcPollingChannelAdapter,,en,dtaSrc,,hi,SÉLECTIONNER,,en,FROM TEST où status = y,,en,Voici un exemple de code XML pour l'intégration printanière,,en,Il contient tous les composants et leurs liaisons,,en,Exemple de XML pour l'intégration Spring,,en,haricots xmlns,,en,int =,,en,www.springframework.org/schema/integration,,en,haricots =,,en,int-stream =,,en,www.springframework.org/schema/integration/stream,,en,www.springframework.org/schema/integration/spring-integration.xsd,,en,www.springframework.org/schema/integration/stream/spring-integration-stream.xsd,,en,ID passerelle =,,en,tests,,et,interface de service =,,en,techalpine.samples.springint,,en,identifiant de canal =,,en,splitter canal d'entrée =,,en,classSplitter,,en,canal de sortie =,,en,école,,en,prof,,en,techalpine.samples.teacher,,en,borne id =,,de,pollerid,,de,taux fixe =,,en,La principale incitation à adopter le cadre d'intégration de Spring,,en(value = “inboundChannel”, poller = @Poller(fixedDelay=”4000″))

public MessageSource<?> storedProc(DataSource dtaSrc) {

return new JdbcPollingChannelAdapter(dtaSrc, “SELECT * FROM TEST where status = y”);

}

Following is a sample XML for spring integration. It contains all the components and their bindings.

Listing 3: Sample XML for Spring integration

<?xml version=”1.0″ encoding=”UTF-8″?>

<des haricots:beans xmlns:int=”http://www.springframework.org/schema/integration”

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xmlns:beans=”http://www.springframework.org/schema/beans”

xmlns:int-stream=”http://www.springframework.org/schema/integration/stream”

xsi:schemaLocation=”http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/integration

http://www.springframework.org/schema/integration/spring-integration.xsd

http://www.springframework.org/schema/integration/stream

http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd”>

<int:gateway id=”testid” service-interface=”techalpine.samples.springint”/>

<int:channel id=”classes”/>

<int:splitter input-channel=”classes” ref=”classSplitter”

method=”Divisé” output-channel=”school”/>

<des haricots:id = bean”teacher” class =”techalpine.samples.teacher”/>

<int:poller id=”pollerid” default=”vrai” fixed-rate=”2000″/>

</des haricots:des haricots>








Conclusion

The main incentive of adopting the Spring integration framework, autre que le fait qu'il s'agisse d'une solution d'intégration d'entreprise utile,,en,est-ce un framework open source?,,en,Les entreprises peuvent modifier ou modifier le code source et l'adapter à leurs besoins spécifiques,,en,Encore,,en,les capacités initiales du cadre resteront intactes et les organisations pourront intégrer leurs applications logicielles,,en,Il existe également quelques alternatives sur le marché, telles que la solution Camel d’Apache, qui est également capable de capturer les modèles d’intégration d’entreprise, bien que dans l’ensemble,,en,L'intégration printanière est plus populaire,,en,Intégration Spring,,en,techalpine.com/steps-to-work-with-spring-integration,,en, is it is an open source framework. Enterprises can modify or tweak the source code and adapt it to their unique needs. Yet, the original capabilities of the framework will remain pristine and organizations will be able to integrate their software applications. There are also a few alternatives available in the market such as the Camel solution from Apache which is also able to capture the patterns of enterprise integration although overall, Spring integration has been more popular.

============================================= ============================================== Buy best TechAlpine Books on Amazon
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share