summaryrefslogtreecommitdiffstats
path: root/Master/Daten- und Systemintegration/DSI-Assignment/Camel.lyx
blob: 32e77b6e9d670d6808b1638fe9ad5c62c61f5964 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
#LyX 1.6.5 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
\textclass scrreprt
\begin_preamble
\usepackage{preamble}
\end_preamble
\options twoside,openright,titlepage,fleqn,pointlessnumbers,headinclude,10pt,a4paper,BCOR5mm,footinclude,cleardoubleempty
\use_default_options false
\language ngerman
\inputencoding auto
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\paperfontsize 10
\spacing single
\use_hyperref false
\papersize a4paper
\use_geometry false
\use_amsmath 1
\use_esint 0
\cite_engine natbib_numerical
\use_bibtopic false
\paperorientation portrait
\secnumdepth 2
\tocdepth 2
\paragraph_separation indent
\defskip medskip
\quotes_language polish
\papercolumns 1
\papersides 2
\paperpagestyle default
\tracking_changes false
\output_changes false
\author "" 
\author "" 
\end_header

\begin_body

\begin_layout Chapter
Apache Camel
\end_layout

\begin_layout Section
Beschreibung
\end_layout

\begin_layout Standard
Die Internetseite zum Projekt 
\begin_inset CommandInset citation
LatexCommand citep
key "Camel"

\end_inset

 beschreibt Apache Camel als Opensource Integrationsframework für EIPs.
 Die Implementierung verwendet Java als Programmiersprache und legt besonderes
 Augenmerk auf eine starke Modularisierung des Frameworks.
 Dies führt zu einem Plugin-Konzept, das es dem Entwickler erlaubt, nur
 die Camel-Kompenenten seiner Lösung hinzuzufügen, die er für sie tatsächlich
 benötigt.
 In der Termininolgie des Camel Projekts tauchen sehr oft die Begriffe Component
, im Deutschen Komponente, und Route auf.
 Zur Implementierung einer Integrationslösung auf Basis von Camel verbinden
 eine oder mehrere Routen mehrere Komponenten als eine Abfolge von Routing-
 und Mediationsregeln.
 Innerhalb einer Route lassen sich Komponenten über URIs referenzieren.
 Eine Route besteht aus dem Start- und einem Endpunkt, die jeweils durch
 Komponenten repräsentiert werden.
 Die meisten Kompontentypen stehen in eigenen Plugins zur Verfügung, wodurch
 der Entwickler nur die Plugins benötigt, deren Komponenten er verwendet.
 Dieses Konzept erleichert die Erweiterung von Camel um weitere Komponenten.
\end_layout

\begin_layout Standard
Da Apache Camel auf Maven 
\begin_inset CommandInset citation
LatexCommand citep
key "Mvn"

\end_inset

 als Build-System basiert, lassen sich zusätzlich Plugins sehr einfach über
 die zentrale Steuerungsdatei vom Maven (pom.xml) per dependency injection
 zum eigenen Projekt hinzufügen.
 Maven versucht neue Abhängigkeiten aufzulösen und die entsprechenden Artefakte,
 meistens jar-Dateien, aus zentralen Repositories im Internet herunterzuladen.
 Maven ist kein Bestandteil von Camel, weshalb es separat von 
\begin_inset CommandInset citation
LatexCommand citep
key "Mvn"

\end_inset

 heruntergeladen und installiert werden muss.
\end_layout

\begin_layout Standard
Der Kern von Apache Camel und die Plugins stehen auf 
\begin_inset CommandInset citation
LatexCommand citep
key "Camel"

\end_inset

 zum Herunterladen bereit.
 Dort finden sich auch die Einträge für die Datei pom.xml, um ein Plugin
 als Abhängigkeit zu definieren und es so dem eigenen Projekt hinzuzufügen.
 Maven übernimmt dann automatisch das Herunterladen der benötigten Dateien.
 Leider würde eine tiefergehende Betrachtung von Maven den Rahmen dieser
 Arbeit überschreiten.
\end_layout

\begin_layout Standard
Das zentrale Element einer Integrationslösung auf Basis von Apache Camel
 ist ein Java-Objekt vom Typ 
\shape italic
CamelContext
\shape default
.
 Diesem Objekt fügt der Integrator Routen hinzu.
 Routen lassen sich in einer Java-Klasse definieren, die von der Klasse
 
\shape italic
RouteBuilder
\shape default
 erbt und die Methode 
\shape italic
configure
\shape default
 überschreibt.
 Nachdem der 
\shape italic
CamelContext
\shape default
 über alle Routen verfügt läßt er sich durch den Aufruf der Methode 
\shape italic
start
\shape default
 starten bzw.
 durch die Methode 
\shape italic
stop
\shape default
 beenden.
 Nach dem Starten des CamelContextes lassen sich Nachrichten entlang der
 definierten Routen verschicken und verarbeiten.
\end_layout

\begin_layout Section
Grundkonzept zur Implementierung von EIPs
\end_layout

\begin_layout Labeling
\labelwidthstring 00.00.0000
Message
\begin_inset space ~
\end_inset

Channel: Apache Camel stellt das EIP Message Channel als interne Implementierung
 des Interfaces Endpoint bereit.
\end_layout

\begin_layout Labeling
\labelwidthstring 00.00.0000
Message
\begin_inset space ~
\end_inset

Endpoint: Dieses EIP läßt sich durch Implementieren des Interfaces Endpoint
 realisieren.
 Im Normalfall verwendet eine Camel-Lösung dieses EIP über URIs in Routen.
\end_layout

\begin_layout Labeling
\labelwidthstring 00.00.0000
Message: Das Interface Message dient der Bereitstellung des EIP Message.
 Dabei lassen sich grundsätzlich zwei Typ von Nachrichten unterscheiden.
 Eingehende Nachrichten vom Typ 
\begin_inset Quotes pld
\end_inset

InOnly
\begin_inset Quotes prd
\end_inset

 wie z.
 B.
 ereignisgesteuerte Nachrichten und Nachrichten vom Typ 
\begin_inset Quotes pld
\end_inset

InOut
\begin_inset Quotes prd
\end_inset

, deren Nachrichtenaustausch eine Antwortnachricht enthält.
\end_layout

\begin_layout Section
Ausgewählte Endpunkte und ihre URIs
\end_layout

\begin_layout Standard
\begin_inset Float table
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Tabular
<lyxtabular version="3" rows="10" columns="3">
<features>
<column alignment="left" valignment="top" width="0">
<column alignment="left" valignment="top" width="0">
<column alignment="left" valignment="top" width="60text%">
<row>
<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Komponente
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
URI
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Beschreibung
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Direct
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

direct:destination
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Synchroner Aufruf eines internen Endpunkts im gleichen Kontext
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
JMS
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

jms:[topic:]destination
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Anbindung an ein Java Messaging System wie z.
 B.
 ApacheActiveMQ
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
JBI
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

jbi:serviceName
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Anbindung an ein JBI-System wie z.
 B.
 Apache ServiceMix
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
JDBC
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

jdbc:dataSourceName?options 
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Zugriff auf JDBC Ressourcen
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
SEDA
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

seda:destination
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Asynchroner Aufruf eines internen Endpunkts im gleichen Kontext
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Bean
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

bean:beanRef
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Übergabe an einfache Java Objekte
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
CXF
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

cxf:address[?serviceClass=...] 
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Integration von CXF basierten Webservices
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Velocity
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

velocity:someTemplateResource
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Verarbeitung einer Nachrichts mittels Velocity Vorlagen
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
SMTP
\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
\begin_inset Quotes pld
\end_inset

smtp://user-info@host[:port]
\begin_inset Quotes prd
\end_inset


\end_layout

\end_inset
</cell>
<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Versenden von E-Mails mittels SMTP und JavaMail
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset Caption

\begin_layout Plain Layout
Endpunkte und ihre URIs
\end_layout

\end_inset


\begin_inset CommandInset label
LatexCommand label
name "Tab:EndpointsURIs"

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
Die Tabelle 
\begin_inset CommandInset ref
LatexCommand ref
reference "Tab:EndpointsURIs"

\end_inset

 zeigt eine Auflistung interessanter Endpunkte, die Apache Camel bereitstellt.
 Eine vollständige Liste findet sich auf 
\begin_inset CommandInset citation
LatexCommand citep
key "Camel"

\end_inset

.
 Weiterhin erlaubt es Camel eigene Endpunkte zu implementieren.
\end_layout

\begin_layout Section
Implementierungsalternativen
\end_layout

\begin_layout Standard
\begin_inset CommandInset label
LatexCommand label
name "sec:CamelDSLXML"

\end_inset


\end_layout

\begin_layout Standard
Apache Camel bietet dem Entwickler zwei Möglichkeiten, Routen zu definieren.
\end_layout

\begin_layout Description
JavaDSL: Mit dieser Variante der Routendefinition lassen sich in eine sog.
 domain specific language (DSL) formulieren.
 Diese Art der Formulierung ähnelt herkömmlichen Methodenaufrufen in Java
 und läßt sich in gängigen Entwicklungsumgebungen verwenden.
 Routen lassen sich somit programmieren.
 Eine weitere bedeutende Eigenschaft der JavaDSL ist die Typen-Sicherheit,
 da die implementierende Java-Klasse vor dem Start kompiliert werden muss.
 Somit kann der Javacompiler die formale Korrektheit der Routendefinition
 überprüfen.
\end_layout

\begin_layout Description
XML: Bei dieser Methode werden die Routen in einer XML-Datei beschrieben
 und zur Laufzeit beim Start des Systems vom Spring-Framework 
\begin_inset CommandInset citation
LatexCommand citep
key "spring"

\end_inset

 umgesetzt.
 Hierbei steht eine enge Verzahnung mit dem Spring Framework, das u.
 a.
 die Lebenszyklen der verwendeten Objekte steuert.
 Eine ausführliche Betrachtung des Spring Frameworks würde leider den Rahmen
 dieser Arbeit überschreiten.
\end_layout

\begin_layout Section
Generierung eines Apache Camel Artefakts
\end_layout

\begin_layout Standard
In der Windows-Konsole in einem leeren Verzeichnis erzeugt Maven mit dem
 Kommando 
\begin_inset listings
lstparams "basicstyle={\ttfamily},breaklines=true,tabsize=2"
inline false
status open

\begin_layout Plain Layout

mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeAr
tifactId=camel-archetype-java -DarchetypeVersion=2.0.0 -DgroupId=de.h_da.fbi.dsi.ws091
0 -Dpackage=de.h_da.fbi.dsi.ws0910.camelprototype -DartifactId=camelprototype
\end_layout

\end_inset

ein neues Artefakt, das als Ausgangspunkt für die zu entwickelnde Apache
 Camel Integrationslösung dienen kann.
 Dabei sind die Parameter artifactId und package entsprechend anzupassen.
 Das Artefakt enthält eine vordefinierte Beispielroute und läßt sich direkt
 mit dem Kommando 
\family typewriter
mvn camel:run
\family default
 ausführen.
\end_layout

\end_body
\end_document