WebSphere Message Broker Patterns: Generate applications ...€¦ · WebSphere Message Broker...

80
David Coles – WebSphere Message Broker Level 3 Technical Lead, IBM Hursley – [email protected] Thusday 11 th August 2011 WebSphere Message Broker Patterns: Generate applications in an instant

Transcript of WebSphere Message Broker Patterns: Generate applications ...€¦ · WebSphere Message Broker...

David

Cole

s –

WebS

phere

Message B

roker

Level 3 T

echnic

al Lead,

IBM

Hurs

ley –

dcole

s@

uk.ibm

.com

Thusday

11

thA

ugust 2011

Web

Sp

here

Messag

e B

roker

Patt

ern

s:

Gen

era

te a

pp

licati

on

s in

an

in

sta

nt

Ag

en

da

•O

verv

iew

•P

attern

s•

Bro

ker

Navig

ato

r

•P

attern

s E

xplo

rer

•P

attern

Para

me

ters

•G

ene

ration

•D

eplo

ym

ent

•B

uilt

-in P

attern

s

•P

attern

Auth

oring

•P

rincip

les a

nd W

ork

flow

•D

esig

n W

alk

-Thro

ugh

•E

xpre

ssio

ns, E

nable

ment &

Enum

era

ted T

ypes

•P

attern

Refinem

ent

•Java

•P

HP

•D

ebuggin

g

•P

attern

Com

munitie

s

2

�U

niv

ers

al C

on

nectivity

–S

implif

y a

pplic

ation c

onnectivity t

o p

rovid

e a

fle

xib

le a

nd d

ynam

ic infr

astr

uctu

re–

Route

s a

nd t

ransfo

rms m

essages f

rom

an

yw

here

, to

an

yw

he

re–

Support

s a

wid

e r

ange o

f p

roto

cols

•M

Q, JM

S 1

.1,

HT

TP

(S),

Web S

erv

ices (

SO

AP

, R

ES

T),

file

, E

RP

(S

AP

,S

EB

L…

), T

CP

/IP

–S

upport

s a

bro

ad

range

of

data

fo

rmats

•B

inary

(C

/CO

BO

L),

XM

L, C

SV

, In

dustr

y (

SW

IFT

, E

DI, H

L7…

), I

DO

Cs, user

defined

�In

tera

ctions a

nd O

pera

tions

–R

oute

, filter,

tra

nsfo

rm, en

rich, m

onitor,

dis

trib

ute

, decom

pose, corr

ela

te, de

tect…

�S

imple

pro

gra

mm

ing

–P

attern

s b

ased f

or

top-d

ow

n, pa

ram

ete

rized c

onnectivity o

f com

mon u

se c

ases

•W

eb S

erv

ice façades, m

essage o

riente

d p

rocessin

g, queue to file

–C

onstr

uction b

ased fo

r bo

ttom

-up

assem

bly

of

bespoke c

onnectivity logic

•M

essage flo

ws to d

escribe a

pplic

ation c

onnectivity c

om

prisin

g…

•M

essage n

odes w

hic

h e

ncapsula

te r

equired inte

gra

tion logic

whic

hopera

te o

n…

•M

essage tre

e w

hic

h d

escribes the d

ata

in a

form

at in

dependent m

anner

•T

ransfo

rmation o

ptions inclu

de g

raphic

al m

appin

g, P

HP

, Java,

ES

QL, X

SL a

nd W

TX

�O

pera

tion

al M

anag

em

ent

an

d P

erf

orm

ance

–E

xte

nsiv

e a

dm

inis

tration a

nd s

yste

ms m

anagem

ent fa

cili

ties for

de

velo

ped s

olu

tions

–W

ide r

ange o

f op

era

ting s

yste

m a

nd h

ard

wa

re p

latf

orm

s s

upport

ed

–O

ffe

rs p

erf

orm

an

ce o

f tr

aditio

nal tr

ansaction p

rocessin

g e

nvironm

ents

Ov

erv

iew

3

Th

e C

ha

lle

ng

e

Fro

m:

MQ

File

WS

DL

To:

4

To

p-d

ow

n v

sB

ott

om

-up

De

ve

lop

me

nt

MQ

File

WS

DL

5

Pa

tte

rns

fo

r S

imp

lifi

ed

De

ve

lop

me

nt

�C

reate

s top-d

ow

n, para

mete

rized c

onnectivity s

olu

tions

–W

eb S

erv

ice f

açades,

messag

e o

riente

d p

rocessin

g,

qu

eue-t

o-f

ile

�R

educes c

om

mon p

roble

ms in flo

w d

evelo

pm

ent

�C

om

munic

ate

s b

est pra

ctices to the B

roker

com

munity

�C

om

ple

ments

exis

ting b

ottom

-up c

onstr

uction for

bespoke c

onnectivity

�R

educes tim

e-t

o-v

alu

e for

solu

tion d

evelo

pm

ent

�P

attern

s a

re a

first cla

ss c

itiz

en in M

essage B

roker

–P

att

ern

s h

ave b

ubb

led r

ight

to t

he t

op in t

he

navig

ato

r vie

w!

6

Pattern

s

Me

ss

ag

e B

rok

er

Na

vig

ato

r

�U

ser

is d

irecte

d tow

ard

s a

new

entr

y

poin

t fo

r develo

pm

ent

�F

irst cla

ss d

evelo

pm

ent m

echanis

m

�A

ugm

ents

oth

er

sta

rtin

g p

oin

ts:

�W

SD

L, S

CA

, A

dapte

r

�D

oes n

ot re

pla

ce the e

xis

ting b

ottom

up

develo

pm

ent appro

ach

�S

till

com

ple

tely

valid

to s

tart

fro

m flo

ws,

message s

ets

etc

!

8

Pa

tte

rns

Ex

plo

rer

�P

attern

s E

xplo

rer

�P

re-s

upplie

d IB

M p

attern

s

�P

attern

cate

gories

�G

roups s

imila

r solu

tions togeth

er

�M

essage-b

ased inte

gra

tion,

serv

ice e

nable

ment, s

erv

ice

virtu

aliz

ation…

�E

xte

nsiv

e h

elp

is a

vaila

ble

thro

ugh a

pattern

specific

ation

�P

rovid

es s

ele

ction a

nd

imple

menta

tion g

uid

ance for

the

pattern

s

9

Pa

tte

rn P

ara

me

ters

�C

usto

miz

e a

patt

ern

usin

g p

att

ern

para

mete

rs

�In

sta

nce n

am

e id

entifies p

attern

; duplic

ate

nam

es w

ill o

ptionally

be o

verw

ritten

�P

ara

mete

rs a

re logic

ally

gro

uped into

sections

�M

andato

ry p

ara

mete

rs a

re indic

ate

d v

ia *

, m

issin

g p

ara

mete

rs a

rein

dic

ate

d v

ia x

�F

ield

s a

re w

ate

rmark

ed a

nd

pre

-popula

ted, fo

r e

xam

ple

: availa

ble

message s

ets

�D

eta

iled h

elp

is a

vaila

ble

for

each p

atte

rn p

ara

me

ter

�C

lick the G

en

era

tebu

tton

to

cre

ate

the g

ene

rate

d a

rte

facts

: m

essage flo

ws,

scripts

10

Ge

ne

rati

on

�A

work

ing s

et is

cre

ate

d, it inclu

des o

nly

the c

urr

ent pattern

�T

he P

roje

cts

vie

w c

onta

ins the g

enera

ted p

roje

cts

�T

he P

att

ern

s In

sta

nces v

iew

conta

ins the p

attern

insta

nce p

roje

cts

�In

clu

des t

he c

onfigura

tion X

ML a

nd s

um

mary

pa

ge

�P

attern

s d

o n

ot attem

pt to

pro

vid

e life c

ycle

managem

ent!

11

De

plo

ym

en

t

�N

oth

ing c

hanges fro

m r

egula

r build

and d

eplo

y a

ctivitie

s

�B

uild

BA

R f

ile a

s u

sual fr

om

genera

ted a

ssets

�D

eplo

y a

s u

su

al, t

hro

ugh M

BX

or

the t

oolk

it

�P

attern

insta

nce m

ay c

reate

additio

nal ru

ntim

e c

ontr

ols

�F

or

exam

ple

, a

UD

P t

o c

ontr

ol err

or

logg

ing/t

race

�T

hese c

an b

e c

usto

miz

ed a

s n

orm

al

12

Bu

ilt-

In P

att

ern

s

•M

essage B

roker

pro

vid

es a

core

set of built

-in p

attern

s

•T

hese im

ple

ment a v

ariety

of com

mon s

cenarios

•W

eb s

erv

ice fro

nt end t

o a

MQ

ba

sed a

pplic

ation

•P

rocessin

g d

ata

sto

red in a

file

and r

ou

ting to o

ne

or

more

queues

•A

ddin

g a

pro

xy in f

ront

of

a w

eb s

erv

ice p

rovid

er

•P

rocessin

g d

ata

fro

m a

n S

AP

syste

m a

nd

routing t

o M

Q

•S

hre

ddin

g m

essages a

nd r

ou

ting to o

ne

or

more

queues

•P

attern

s a

re s

ele

cte

d b

ased o

n c

lient fe

edback a

nd fie

ld e

xperience

•T

his

core

set of pattern

s c

ontinues to g

row

with e

ach r

ele

ase

•M

Q t

o w

eb s

erv

ice p

atte

rn a

dded

in M

essage B

roker

v7 F

P1

13

Pattern

Auth

oring

Pri

nc

iple

s (

Pa

rt I

)

•P

attern

s a

nd p

attern

auth

oring a

re first cla

ss c

oncepts

•P

attern

auth

oring is a

desig

n a

ctivity

•It m

ay b

e long liv

ed

•It is o

ften n

ot seq

uential

•U

sin

g p

attern

s is a

top-d

ow

n a

ctivity d

riven b

y a

requirem

ent, b

ut:

•A

uth

oring a

n e

xe

mpla

r is

(ty

pic

ally

) a

bott

om

-up a

ctivity

•S

o p

atte

rn a

uth

oring m

ust b

ridge t

hese t

wo d

iffe

rent app

roaches

•P

attern

s h

ave their o

wn d

evelo

pm

ent cycle

•W

e a

lways s

tart

with a

work

ing e

xem

pla

r -

one o

r m

ore

Bro

ker

pro

jects

•C

reating the e

xem

pla

r is

part

of th

e p

attern

auth

oring p

rocess

15

Pri

nc

iple

s (

Pa

rt I

I)

•T

he B

roker

imple

menta

tion o

f pattern

auth

oring is a

Toolk

it e

xperience

•P

attern

auth

oring is a

managed u

ser

experience -

a u

ser

should

not need

to u

nders

tand B

roker

inte

rnals

, or

oth

er

imple

menta

tion technolo

gie

s

•A

pattern

encapsula

tes o

ne o

r m

ore

exem

pla

r pro

jects

and a

set of

configura

tion that:

•Looks d

ow

n to

th

e e

xem

pla

r p

roje

cts

to s

ele

ct pro

jects

, file

s a

nd p

ropert

ies

•Looks u

p to t

he u

ser

inte

rface th

at

will

be p

resente

d to t

he p

atte

rn u

ser

•A

llow

s p

attern

au

thors

to e

xte

nd

their p

atte

rn w

ith P

HP

and J

ava

code

•D

escribes a

patt

ern

and

its

cate

gories thro

ugh

an H

TM

L s

pecific

ation

•P

rovid

e g

uid

ance s

o that a p

attern

auth

or

can c

reate

exem

pla

rs r

eady for

pattern

auth

oring

•P

attern

auth

oring c

reate

s p

attern

s w

hose v

alu

e m

ultip

lies a

s they a

re

share

d a

nd u

sed b

y a

com

munity o

f develo

pers

!

16

Wo

rkfl

ow

17

Desig

n W

alk

Thro

ugh

De

fin

e t

he

Ta

rge

t P

rop

ert

ies

19

De

fin

e t

he

Ta

rge

t P

rop

ert

ies

20

De

sig

n P

oin

ts

•P

attern

s a

re c

reate

d in the B

roker

Toolk

it

•P

attern

s a

re d

esig

ned in a

Pattern

Auth

oring p

roje

ct and e

ditor

•V

ariabili

ty is e

xpre

ssed in the T

oolk

it e

ditors

•T

he first

rele

ase s

upport

s p

ropert

y v

ariabili

ty in the

Flo

w E

ditor

•P

ropert

y v

ariabili

ty is b

ased o

n flo

w a

nd

User

De

fined P

ropert

ies (

UD

Ps)

•A

ddin

g v

ariabili

ty in the e

ditors

als

o s

upport

s a

use c

ase w

he

ree

xe

mpla

r p

roje

cts

are

used in m

ultip

le p

atte

rns

21

Cre

ate

A P

att

ern

Au

tho

rin

g P

roje

ct

22

Cre

ate

A P

att

ern

Au

tho

rin

g P

roje

ct

23

De

sig

n P

oin

ts

•A

pattern

can g

enera

te o

ne o

r m

ore

message flo

w p

roje

cts

•A

pattern

can c

onta

in r

efe

rences to p

roje

cts

whic

h the e

nd u

ser

is

expecte

d to h

ave in their w

ork

space

•A

pattern

genera

tes p

roje

cts

that m

atc

h the p

roje

cts

in the e

xem

pla

rs

•P

roje

cts

are

nam

ed follo

win

g p

attern

insta

nce n

am

ing c

onventions. F

or

exa

mple

, if t

he

exem

pla

r p

roje

ct

nam

e is invoicing

and t

he p

att

ern

insta

nce n

am

e is foo

, th

en

the

genera

ted p

roje

ct

will

be c

alle

d foo_invoicing

. T

his

sim

ple

rule

favours

convention

over

configura

tion. T

he

patt

ern

au

thor

can n

am

e th

eir e

xem

pla

r p

roje

cts

accord

ingly

.

•T

he p

attern

auth

or

sele

cts

their e

xem

pla

r pro

jects

when a

new

Pattern

A

uth

oring p

roje

ct is

cre

ate

d•

The P

atte

rn A

uth

oring p

roje

ct m

ain

tain

s r

efe

rences to t

he e

xem

pla

r pro

jects

•T

he

se

refe

ren

ce

s a

re s

tanda

rd E

clip

se

pro

ject

depend

en

cie

s

•T

he e

xe

mpla

r p

roje

ct file

s a

re c

opie

d into

the p

att

ern

plu

g-in w

hen

the p

att

ern

is b

uilt

24

Se

lec

t T

he

Fil

es

an

d R

es

ou

rce

s

25

Se

lec

t T

he

Fil

es

an

d R

es

ou

rce

s

26

De

sig

n P

oin

ts

•A

pattern

auth

or

chooses the file

s to inclu

de fro

m their e

xem

pla

r pro

jects

•T

his

support

s a

use c

ase w

here

a p

atte

rn a

uth

or

ha

s a

lib

rary

pro

ject

that

conta

in m

an

y

re-u

sable

assets

not all

of w

hic

h a

re a

pplic

able

to a

ny g

iven p

atte

rn.

•C

hoosin

g a

file

im

plic

itly

sele

cts

all

targ

et pro

pert

ies in thatfile

•B

y d

efa

ult,

all

file

s in a

n e

xem

pla

r pro

ject are

sele

cte

d

•T

arg

et pro

pert

ies c

an b

e a

dded a

nd r

em

oved in the e

xem

pla

r pro

jects

•T

he P

atte

rn A

uth

oring p

roje

ct can b

e r

efr

eshed t

o p

ick these u

p

•D

ouble

clic

kin

g a

file

opens the e

ditor

•A

uth

oring a

patt

ern

is a

non s

eque

ntial desig

n a

ctivity!

•D

ependin

g o

n the p

roje

ct ty

pe, som

e file

s a

nd d

irecto

ries m

ay n

eed to b

e

exclu

ded (

such a

s the bin

directo

ry in a

Java p

roje

ct)

27

De

fin

e T

he

Us

er

Inte

rfa

ce

28

Co

nfi

gu

re P

att

ern

Pa

ram

ete

rs (

Be

fore

)

29

30

Co

nfi

gu

re P

att

ern

Pa

ram

ete

rs (

Aft

er)

31

De

sig

n P

oin

ts

•E

very

file

conta

inin

g o

ne o

r m

ore

targ

et pro

pert

ies h

as a

pattern

para

mete

r gro

up c

reate

d a

uto

matically

•Lik

ew

ise, every

targ

et pro

pert

y h

as a

pattern

para

mete

r cre

ate

d

auto

matically

•T

he p

attern

is a

lways in a

valid

sta

te e

ven w

ith n

o r

efinem

ent

•P

attern

para

mete

r gro

ups c

an b

e a

dded, dele

ted a

nd e

dited a

s r

equired

•T

he d

efa

ult n

am

e fo

r a

patt

ern

pa

ram

ete

r g

roup is b

ased o

n the f

ile n

am

e

•O

nly

em

pty

pa

tte

rn p

ara

me

ter

gro

ups c

an b

e d

ele

ted

•P

attern

para

mete

rs c

an b

e a

dded, dele

ted a

nd e

dited a

s r

equired

•T

he d

efa

ult n

am

e fo

r a

patt

ern

pa

ram

ete

r is

based o

n the

ta

rget

pro

pert

y n

am

e

•O

nly

em

pty

pa

tte

rn p

ara

me

ters

can b

e r

em

oved –

targ

et

pro

pe

rtie

s c

annot float

free

,

the

y m

ust

alw

ays b

e m

apped

to

a p

atte

rn p

ara

me

ter

•T

he 1

:1 m

appin

g b

etw

een p

attern

para

mete

rs c

an b

e c

hanged b

y

shufflin

g the targ

et pro

pert

ies a

round (

dra

g a

nd d

rop)

32

Ad

d P

att

ern

Ca

teg

ori

es

33

De

sig

n P

oin

ts

•C

ate

gory

specific

ation is typic

ally

one H

TM

L file

•E

ach c

ate

gory

gets

a d

irecto

ry to s

tore

its

specific

ation

•P

attern

Auth

oring e

ditor

cre

ate

s a

skele

ton file

in the d

irecto

ry

•P

attern

auth

or

can u

se a

ny H

TM

L e

ditor

they c

hoose

•S

pecific

ation is p

ackaged into

the p

attern

plu

g-ins w

hen they a

re c

reate

d

•B

y c

onvention the c

ate

gory

specific

ation is c

alle

d overview.htm

•A

ll file

s a

nd s

ub-d

irecto

ries a

re p

ackaged a

s w

ell

•F

or

exa

mple

, to

bra

nd t

he c

ate

go

ry w

ith im

ages a

nd s

tyle

sheets

(CS

S)

•T

here

are

no r

estr

ictions o

n w

here

new

cate

gories a

re a

dded

•T

he p

att

ern

can b

e a

dded to

an

y c

ate

gory

either

exis

ting o

r ne

w

34

Bu

ild

Th

e P

att

ern

Plu

g-i

ns

35

Bu

ild

Th

e P

att

ern

Plu

g-i

ns

36

De

sig

n P

oin

ts

•T

he P

attern

Auth

oring E

ditor

cre

ate

s E

clip

se p

lug-ins

•E

clip

se p

rovid

es e

xcelle

nt support

fo

r plu

g-ins a

nd f

eatu

res fo

r dis

trib

ution

•S

om

e p

lug-in info

rmation is r

equired s

uch a

s p

rovid

er

and v

ers

ion

•It is n

ot re

com

mended to e

dit the g

enera

ted p

lug-ins

•O

ne

exception is to a

dd

tra

nsla

ted p

rope

rty f

iles into

the

NLS

plu

g-ins

37

Te

st

Th

e P

att

ern

38

Te

st

Th

e P

att

ern

39

De

sig

n P

oin

ts

•T

esting a

pattern

requires a

re-launch o

f th

e T

oolk

it

•R

un c

onfigura

tions a

re a

n o

ften m

isunders

tood a

rea o

f E

clip

se d

evelo

pm

ent so the

Pattern

Auth

orin

g E

ditor

pro

vid

es a

sim

ple

wa

y to

re

-launch the too

lkit:

•T

he p

attern

appears

in the P

attern

Explo

rer

and is r

eady to test

•T

he P

atte

rn A

uth

oring E

ditor

will

allo

w n

ew

cate

go

ries to b

e c

reate

d

•A

skele

ton p

atte

rn s

pecific

ation is c

reate

d w

hic

h c

an a

lso b

e c

hanged

•T

his

ste

p c

om

ple

tes the a

pplic

ation d

evelo

pm

ent cycle

for

a p

attern

•In

pra

ctice a

patt

ern

au

thor

would

loop a

round t

he

se s

teps m

an

y tim

es!

40

Tra

ns

form

ati

on

•T

he P

attern

Auth

oring e

ditor

uses X

Path

as its

expre

ssio

n language

•X

Path

is a

genera

l purp

ose e

xp

ressio

n language

!

•X

Path

expre

ssio

ns c

an tra

nsfo

rm p

attern

para

mete

r valu

es:

•P

attern

auth

ors

can c

onfigure

an X

Path

expre

ssio

n fo

r a

patt

ern

pa

ram

ete

r

•E

xpre

ssio

ns a

re e

valu

ate

d w

hen t

he p

atte

rn insta

nce is g

enera

ted

41

En

ab

lem

en

t

•E

nable

ment uses a

n X

Path

expre

ssio

n to c

ontr

ol w

hen a

pattern

para

mete

r is

enable

d in the P

attern

Insta

nce e

ditor

•T

he e

nable

ment expre

ssio

n is e

valu

ate

d e

very

tim

e a

pattern

para

mete

r re

fere

nced in the X

Path

expre

ssio

n c

hanges v

alu

e

•If the r

esult o

f th

e e

valu

ation is true

then the e

ditor

is e

nable

d

42

En

um

era

ted

Typ

es

•T

arg

et pro

pert

ies a

re s

trongly

typed

•S

trin

g, in

teger,

boole

an

and e

num

era

tions a

nd th

e m

ost

com

mon t

ypes

•A

n e

num

era

tion is a

lis

t of perm

issib

le v

alu

es for

a g

iven p

ropert

y:

•T

he P

attern

Auth

oring e

ditor

has full

support

for

enum

era

tions

•A

n e

num

era

ted t

ype is a

uto

ma

tically

cre

ate

d w

hen a

ta

rge

t p

ropert

y is a

dded

•T

he e

num

era

ted

type

inclu

des the d

ispla

y n

am

es a

nd p

rope

rty v

alu

es

•T

he lis

t of valu

es p

resente

d to

the

patte

rn u

ser

can

be r

educed if

required

43

Pattern

Refinem

ent

Ov

erv

iew

•P

attern

auth

oring in M

essage B

roker

FP

1 s

upport

s p

ropert

y c

hanges

(node, U

DP

and p

rom

ote

d n

ode p

ropert

ies)

•P

ropert

y v

ariabili

ty is the m

ost com

mon type o

f variabili

ty thata p

attern

m

ight need to e

xpre

ss -

there

are

many o

thers

:

•G

ene

rate

applic

ation text

file

s s

uch a

s E

SQ

L s

cripts

•M

ake s

tructu

ral changes to M

essa

ge F

low

s

•C

reate

ad

min

istr

ation file

s s

uch a

s M

QS

C s

cripts

•It is im

possib

le to try

and p

redic

t all

the p

ossib

le e

xte

nsio

ns that a p

attern

auth

or

mig

ht w

ish to im

ple

ment

•In

Message B

roker

FP

2 w

e p

rovid

e tw

o w

ays to e

xte

nd p

attern

auth

oring

•Java c

ode that is

invoked w

hen p

atte

rn insta

nces a

re g

ene

rate

d

•P

HP

tem

pla

tes t

hat gene

rate

te

xt

file

s in p

attern

insta

nce p

roje

cts

45

Wh

ere

Do

es

Yo

ur

PH

P a

nd

Ja

va

Co

de

G

o?

•P

attern

refinem

ents

are

packaged in o

ne o

r m

ore

separa

te p

lug-ins

•P

ackaged a

nd d

istr

ibute

d w

ith the

genera

ted p

att

ern

plu

g-ins

•C

lean s

epara

tion b

etw

een c

ode w

ritten b

y t

he p

att

ern

au

thor

and t

he p

lug-ins g

enera

ted

by t

he P

att

ern

Auth

oring e

ditor

•M

akes it very

ea

sy to

re-u

se J

ava

and P

HP

betw

een p

atte

rns

•S

traig

htfo

rwa

rd t

o v

ers

ion, patc

h a

nd u

pgra

de t

he p

lug-ins

•A

ll th

e p

lug-ins c

an s

till

be p

ackaged in a

sin

gle

ZIP

file

for

dis

trib

ution

•N

ew

pattern

auth

oring w

izard

make it a b

reeze to c

reate

plu

g-ins!

46

Ja

va

an

d P

HP

co

de

•E

asy to a

ttach J

ava a

nd P

HP

code to a

pattern

–th

e c

ode is invoked in

top d

ow

n o

rder

as s

how

n in the P

attern

Auth

oring e

ditor

47

Pa

tte

rn I

ns

tan

ce

Ge

ne

rati

on

48�

The follo

win

g s

equence o

f actions g

enera

tes p

attern

insta

nce p

roje

cts

:1.

The p

att

ern

auth

oring r

un

tim

e c

reate

s the p

atte

rn insta

nce p

roje

cts

2.

All

non m

essage flo

w file

s a

re c

opie

d into

the p

atte

rn insta

nce p

roje

cts

3.

The m

essage flo

ws a

re loaded into

mem

ory

fro

m t

he p

atte

rn p

lug-ins

4.

All

targ

et

pro

pe

rtie

s a

re c

onfigure

d in the m

essage

flo

ws

5.

PH

P a

nd J

ava targ

ets

are

invoked in top-t

o-b

otto

m o

rder

6.

The m

essage flo

ws a

re s

aved into

the p

atte

rn insta

nce p

roje

cts

Ja

va

Co

de

49�Java c

lasses im

ple

ment GeneratePatternInstanceTransform

�T

he p

attern

auth

oring r

untim

e invokes onGeneratePatternInstance

�T

he m

eth

od is p

assed a

refe

rence to a

PatternInstanceManager

–P

rovid

es a

ccess to p

att

ern

pa

ram

ete

rs,

patt

ern

insta

nce n

am

e a

nd

wo

rkspace location

–M

ost im

port

ant

of all,

the J

ava c

lass c

an m

anip

ula

te m

essage flo

ws!

Ja

va

Ex

am

ple

50

�R

etr

ieve a

message flo

w u

sin

g the patternInstanceManager

�P

ass the (

exem

pla

r) p

roje

ct nam

e a

nd the r

ela

tive p

ath

to the file

�T

he m

essage flo

ws a

re loaded into

mem

ory

fro

m the p

attern

plu

g-ins

–T

he flo

ws a

re a

uto

matically

saved into

the p

att

ern

insta

nce p

roje

cts

at th

e e

nd

�Y

our

changes a

ct on the m

essage flo

w im

media

tely

51M

an

ipu

lati

ng

Me

ss

ag

e F

low

s

�T

he MessageFlow

AP

I conta

ins a

ll th

e n

odes, connections a

nd a

rtefa

cts

pre

sent in

the m

essage flo

w

�T

he M

essage F

low

AP

I in

clu

des p

ropert

ies, nodes a

nd c

onnections

–T

his

is n

ot an e

xhaustive lis

t!

�U

ser

Defined N

odes a

re r

epre

sente

d a

s GenericNode

52M

es

sa

ge

Flo

w A

PI

�H

elp

er

meth

ods thro

ughout th

e M

essage F

low

AP

I–

For

exa

mple

, findin

g a

node b

y its

label usin

g getNodeByName

�N

ode p

ropert

ies a

re s

trongly

typed w

here

ver

possib

le

�E

num

era

tions a

re p

rovid

ed for

pro

pert

ies

–Im

ple

mente

d a

s t

ype

-safe

cla

sses

�JavaD

oc

pro

vid

ed for

pro

pert

ies (

easily

vie

wed in the J

ava e

ditor)

53M

es

sa

ge

Flo

w A

PI

�N

odes c

an b

e c

onnecte

d u

sin

g term

inals

(in

the Node

cla

ss)

�D

ynam

ic term

inals

and GenericNode

term

inals

als

o s

upport

ed

54C

rea

tin

g C

on

ne

cti

on

s B

etw

ee

n N

od

es

Co

mp

lex

Pro

pe

rtie

s

�C

om

ple

x p

ropert

ies a

re m

anip

ula

ted u

sin

g o

bje

cts

(ta

ble

s a

nd r

ow

s)

�P

ropert

y v

alu

es o

n r

ow

s a

re s

trongly

typed

�R

ow

s c

an b

e a

dded a

nd r

em

oved fro

m table

s

55

Co

mp

lex

Pro

pe

rtie

s E

xa

mp

le

56

PH

P

•P

HP

is a

gene

ral p

urp

ose

dynam

ic s

crip

ting

langu

age

•E

asy to

use w

ith

a g

en

tle

le

arn

ing

cu

rve

•E

ffic

ien

t syn

tax a

nd

lib

rary

ha

ve

evo

lve

d in

open

sourc

e

•C

om

munity d

riven to g

et m

ore

done in less tim

e

•Im

pre

ssiv

e r

esults w

ith little c

ode

•E

xte

nsiv

e lib

rary

support

•Language w

ell

suited to r

apid

pro

toty

pin

g

•M

ore

than

3 m

illio

n d

eve

lop

ers

wo

rldw

ide

•4

thm

ost p

opu

late

langua

ge

after

Ja

va

, C

and

Vis

ua

l B

asic

•M

essage

Bro

ke

r P

HP

Co

mpu

te N

ode

sin

ce

v6

.1.0

.4•

Java im

ple

menta

tion, fu

lly c

om

plia

nt

with P

HP

vers

ion 5

.2

57

PH

P T

em

pla

tes

58�O

utp

ut fr

om

PH

P tem

pla

te is w

ritten s

traig

ht to

a p

attern

insta

nce file

PH

P S

cri

pts

59�T

he P

HP

script in

vokes o

ther

PH

P tem

pla

tes to o

utp

ut file

s–

Script acts

as a

contr

olle

r and r

un

s o

ther

tem

pla

tes a

s r

equired

�T

ypic

ally

used w

hen c

usto

m logic

is r

equired w

ith p

attern

para

mete

rs

�O

utp

ut fr

om

the c

ontr

olle

r script is

sent to

the C

onsole

vie

w

PH

P E

xa

mp

le (main.php

main.php

main.php

main.php

)

60

PH

P E

xa

mp

le (example.esql.php

example.esql.php

example.esql.php

example.esql.php

)

61

Th

is u

se

s t

he

PH

P echo

fun

ction

to

write

th

e te

xt

into

the

ou

tpu

t file

-th

e e

mbed

ded

P

HP

code

is a

cce

ssin

g p

atte

rn p

ara

me

ters

th

rou

gh

the

_MB

su

pe

r glo

ba

l

Th

is s

ection

of

ES

QL

scrip

t is

cond

itio

na

lly o

utp

ut

de

pend

ing o

n t

he

va

lue

of

the

errorAction

pa

tte

rn p

ara

me

ter

-th

e s

urr

ou

nd

ing P

HP

uses a

H

ER

ED

OC

to

ou

tpu

t th

e c

ode

as a

lite

ral str

ing

Pa

tte

rn A

uth

ori

ng

PH

P S

up

er

Glo

ba

ls

•P

HP

pro

vid

es a

larg

e n

um

be

r of pre

define

d v

ari

able

s to a

ny s

cri

pt

whic

h it

runs

–M

essa

ge B

roke

r ha

s a

n a

dd

itio

na

l sup

er

glo

ba

l calle

d _MB

•_MB

in p

attern

auth

ori

ng is p

op

ula

ted w

ith t

he p

attern

pa

ram

ete

rs, th

e p

attern

insta

nce n

am

e a

nd the PatternInstanceManager

:

62

Ed

itin

g P

HP

On

-Th

e-F

ly

63�

You d

o n

ot need to r

e-launch a

work

bench to test your

PH

P c

hanges

�S

imply

save the file

in the m

ain

work

bench a

nd c

lick G

en

era

teagain

�T

his

edit a

nd test effic

iency is a

majo

r pro

ductivity b

oost

�If y

ou c

hange a

nyth

ing e

lse in the p

attern

then y

ou n

eed to r

e-launch

�It is s

traig

htforw

ard

to invoke J

ava c

ode fro

m y

our

PH

P s

cripts

:

�T

he M

essage B

roker

PH

P r

untim

e h

as a

featu

re r

ich J

ava b

ridge

htt

p:/

/ww

w.p

roje

ctz

ero

.org

/sM

ash

/1.1

.x/d

ocs/z

ero

.de

vgu

ide

.do

c/z

ero

.php

/Ze

roA

dva

nced

PH

PJa

va

Brid

ge

.htm

l

�T

his

PH

P s

cript is

manip

ula

ting the m

essage flo

w u

sin

g the J

ava A

PI!

PH

P a

nd

Ja

va

In

teg

rati

on

64

64

Sta

nd

ard

PH

P F

un

cti

on

s

•T

he f

ull

list

of

support

ed P

HP

exte

nsio

ns a

nd f

unctions a

re lis

ted h

ere

:•

htt

p:/

/pu

blib

.bou

lde

r.ib

m.c

om

/info

cen

ter/

wm

bhe

lp/v

7r0

m0

/to

pic

/com

.ib

m.e

too

ls.m

ft.d

oc/a

c69

026_

.htm

•E

xte

nsiv

e h

elp

on P

HP

is a

vaila

ble

on h

ttp:/

/php.n

et

•In

div

idual fu

nctions c

an b

e locate

d d

irectly, fo

r exam

ple

: http://p

hp.n

et/phpin

fo

•T

he language r

efe

rence for

PH

P is h

ere

: •

htt

p:/

/ww

w.p

hp

.ne

t/m

anu

al/en

/lan

gre

f.php

•T

here

are

a f

ew

language d

iffe

rences b

etw

een t

he M

essage B

roker

PH

P a

nd t

he O

pen S

ourc

e P

HP

im

ple

menta

tion –

they a

re lis

ted h

ere

:•

htt

p:/

/pu

blib

.bou

lde

r.ib

m.c

om

/info

cen

ter/

wm

bhe

lp/v

7r0

m0

/ind

ex.jsp

65

De

bu

gg

ing

Yo

ur

Pa

tte

rn R

efi

ne

me

nts

66�

Java p

attern

refinem

ents

can b

e d

ebugged in the J

ava d

ebugger

�T

he launch c

onfigura

tion is a

uto

matically

cre

ate

d the first tim

eyou test a

pattern

fro

m the P

attern

Auth

oring e

ditor:

�A

ny c

onsole

outp

ut fr

om

your

PH

P o

r Java a

ppears

in the C

onsole

vie

w:

Ex

ce

pti

on

Ha

nd

ing

67�

Exceptions fro

m P

HP

and J

ava c

ode a

re c

aught and d

ispla

yed

So

Wh

ich

La

ng

ua

ge

Sh

ou

ld I

Us

e?

68�

Because o

f th

e J

ava b

ridge in the P

HP

runtim

e, m

any p

attern

auth

oring

tasks c

an b

e d

one in e

ither

language

�S

o h

ere

are

som

e g

enera

l re

com

mendations –

your

mile

age m

ay v

ary

!

�U

se P

HP

for

text file

s that need to b

e m

ark

ed u

p w

ith c

onditio

nal lo

gic

�U

se J

ava to m

anip

ula

te m

essage flo

ws a

s y

ou g

et an e

xcelle

nt

debugger

and c

ode c

om

ple

tion in the J

ava e

ditor

–U

nle

ss y

ou

have P

HP

skill

s a

nd p

refe

r th

e p

roductivity o

f scripting languages!

�If y

ou h

ave e

xis

ting a

ssets

or

libra

ries that you w

ant to

call,

pic

k the

language that best alig

ns w

ith them

Ro

llin

g Y

ou

r O

wn

Plu

g-i

n?

•It m

ust be a

plu

g-in n

ot ju

st a J

ava p

roje

ct!

•Y

our

plu

g-in m

ust export

the J

ava c

lasses that are

to b

e invoked

•Y

ou w

ill n

eed a

refe

rence to com.ibm.broker.config.appdev

•T

here

is a

refe

rence fro

m the p

attern

plu

g-ins to y

our

plu

g-in

•T

he p

att

ern

auth

oring g

enera

tor

adds this

to the

plu

g-in m

anifest

•If it conta

ins P

HP

tem

pla

tes then it m

ust be a

directo

ry p

lug-in

•P

HP

scripts

can o

nly

be

loaded d

irect

from

the

file

syste

m a

nd

not

from

a J

AR

•T

he p

lug-in m

ust be insta

lled b

efo

re p

attern

insta

nces c

an b

e c

reate

d

•S

o thin

k a

bout h

ow

you w

an

t to

dis

trib

ute

you

r cod

e!

69

Pattern

Com

munitie

s

Pa

tte

rn C

om

mu

nit

ies

•P

attern

auth

oring c

reate

s p

attern

s w

hose v

alu

e m

ultip

lies a

s they a

re

share

d a

nd u

sed b

y a

com

munity o

f develo

pers

•P

ublic

and p

rivate

com

munitie

s a

re e

qually

inte

resting!

•S

o h

ow

to d

istr

ibute

and s

hare

pattern

s e

ffectively

?

•A

com

munity n

eeds to o

ffer

more

than just a r

epository

of assets

!

•S

pace f

or

conte

nt

such a

s p

att

ern

s a

nd s

ubflo

wnod

es

•F

oru

ms t

o h

ost

dis

cussio

ns a

nd t

hre

ad

ed c

onvers

atio

ns

•C

ate

gori

satio

n is im

port

ant

as t

he c

om

munity g

row

s! (t

axono

mie

s)

•E

ssential a

dm

inis

trative f

unctions s

uch a

s u

ser

manag

em

en

t

•N

ew

s a

rtic

les a

nd b

roa

dcasts

keep t

he s

ite f

resh

•T

here

are

litera

lly d

ozens o

f conte

nt m

anagem

ent syste

ms a

vaila

ble

•O

n the c

om

merc

ial sid

e w

e h

ave tried L

otu

s C

onnections a

nd R

ational

Asset M

anager

•O

pen s

ourc

e p

roje

cts

such a

s D

rupaland J

oom

laare

availa

ble

71

Pa

ck

ag

ing

a P

att

ern

72

Pa

tte

rn A

rch

ive

s

•T

he g

oal is

to s

implif

y the p

ackagin

g a

nd d

istr

ibution o

f pattern

s

•C

reating E

clip

se u

pdate

sites a

nd featu

res is a

fairly

com

ple

x task

•A

pattern

arc

hiv

e c

onta

ins the p

attern

plu

g-ins a

nd a

n E

clip

se featu

re

•T

he v

ers

ion o

f th

e f

eatu

re m

atc

hes t

he p

att

ern

vers

ion:

73

Cre

ati

ng

a C

om

mu

nit

y S

pa

ce

74

A S

ha

red

Re

po

sit

ory

fo

r P

att

ern

s

75

Dru

pa

l

•T

he d

em

onstr

ation s

yste

m is a

sta

ndard

Dru

palv6 insta

ll•

Dru

palis

a P

HP

-based o

pen-s

ourc

e c

onte

nt

managem

ent syste

m (

CM

S)

•A

key s

trength

of

Dru

palis

its

vib

rant com

munity o

f users

and d

evelo

pers

•D

rupalhas a

n e

xte

nsiv

e lis

t of

ma

ny h

und

reds o

f a

dd-o

n m

odule

s

•T

he follo

win

g c

ontr

ibute

d m

odule

s w

ere

insta

lled:

•V

oting is p

rovid

ed b

yF

iveS

tar

an

dV

otingA

PIm

odule

s

•S

ite s

earc

h is c

onfigure

d (

this

is a

built

in m

odule

)

•A

n e

asy to

use

Adm

inis

tration

mo

dule

is a

vaila

ble

•P

ages b

ased a

round a

n im

age a

re p

rovid

ed b

y t

he

Image

module

•C

ate

gorisation o

f conte

nt

made a

vaila

ble

by the

Taxonom

ym

odule

•It took just over

one h

our

to c

om

ple

te the s

yste

m s

et up!

76

Co

mm

un

ity B

ran

din

g

77

Ins

tall

ing

Pa

tte

rns

•T

he P

atte

rn E

xplo

rer

pro

vid

es a

dow

nlo

ad

capabili

ty fo

r pa

ttern

arc

hiv

es

•P

attern

arc

hiv

es c

an b

e insta

lled fro

m a

local file

syste

m o

r fr

om

a U

RL

•H

TT

P/S

is n

ot support

ed

–in

ste

ad login

,

dow

nlo

ad a

nd insta

ll fr

om

the f

ile s

yste

m

•In

sta

llation c

om

ple

tes w

ithout a

to

olk

it

resta

rt

•P

attern

s a

re u

nin

sta

lled thro

ugh t

he E

clip

se

update

s featu

re:

Help

> S

oftw

are

Update

s

•.patternzip

file

s c

an a

lso b

e d

ouble

clic

ked w

hic

h r

un

s a

n insta

ller

applic

ation

(the

file

exte

nsio

n is r

egis

tere

d b

y the

toolk

it)

78

•M

QS

eries.n

etpa

tte

rns c

om

munity

•A

new

website featu

ring p

attern

s c

reate

d, ra

ted a

nd u

sed b

y t

he m

qseries.n

etcom

munity

•A

natu

ral exte

nsio

n to the c

urr

ent help

and s

upport

foru

ms, oriente

d tow

ard

s b

est pra

ctices

•U

sers

can d

ow

nlo

ad p

attern

s, in

sta

ll th

em

on their local bro

ker,

and g

o!

•D

ouble

-clic

k o

n a

n m

qseries.n

etpattern

to d

ow

nlo

ad into

your

Toolk

it P

attern

s E

xplo

rer!

Thanks to a

ll w

ho h

ave c

ontr

ibute

d to t

he m

qseries.n

etcom

munity

79

An

no

un

cin

g m

qs

eri

es

.ne

tP

att

ern

s

Co

mm

un

ity

Qu

es

tio

ns

–P

lea

se

Fil

l O

ut

Yo

ur

Se

ss

ion

E

va

lua

tio

n F

orm

!

80