-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
101 lines (65 loc) · 3.21 KB
/
README
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
Overview:
This example shows a simple pricing gateway set up that demonstrates the following:
* A trivial implementation of a gateway with command line client,
backend pricing engine and asynchronous gateway listeners.
* The gateway and the pricing engine are written in Scala for its
async behaviours and use OSGi declarative services as the component
model.
* There is a simple blueprint persistence gateway listener written in
Java that takes quotes/requests and writes them to disk
* The command line is a Java OSGi bundle
* The remote communications are pluggable via RSA but the demo will
default to using SLP for discovery and EssenceRMI for the transport.
* Systems and repositories used to deploy the components on the fabric.
Source:
The source is split up into the following directories:
* gateway.api - shared Java api for components
* gateway.persistence - blueprint persistence component
* gateway.cli - simple osgi shell
* gateway.pricer - scala pricing engine using declarative services
* gateway.scripts - scripts to launch components in nimble
* gateway.system - systems to deploy components in fabric
Build:
All the dependencies are packaged with this example so just run ant from the top level gateway directory
$ cd $examples
$ ant -f gateway.build/build.xml
Single JVM:
The following example shows how to setup the components so that they run in a single framework with
no remote communication. First launch posh in the gateway example directory.
$ $fabric/bin/posh
Now build the repositories that nimble will use to install the artifacts
% sh gateway.scripts/repos/makeRepos.osh
% sh gateway.scripts/repos/loadRepos.osh
Install the parts of the example, note that Nimble will download the dependencies from the repository.
% nim add osgi.active.bundle/gateway.cli
% nim add msf/com.example.gateway id=foo
% nim add msf/com.example.pricer#f type=firm
% nim add msf/com.example.pricer#i type=indicative
Now use the gateway cli to connect and request some quotes
% gateway login demo
% gateway request paremus ibm oracle microsoft yahoo
% gateway testbatch --batchSize=10000 --batchCount=10 --requestTimeout=60000
Multi JVM:
This example launches several nimble instances and installs components in each
using slp and essence rmi for the remote discovery/communication
$0 $fabric/bin/posh
$1 $fabric/bin/posh
$2 $fabric/bin/posh
%0 sh gateway.scripts/services/client.osh
%1 sh gateway.scripts/services/impl.osh
%2 sh gateway.scripts/services/pricer.osh
Now use the gateway cli to connect and request some quotes
%0 gateway testbatch --batchSize=10000 --batchCount=10 --requestTimeout=60000
Fabric:
The final example is to deploy these components via the service fabric using a system document.
First launch a number of fibres with one providing the infrastructure services.
$0 $fabric/bin/posh
$1 $fabric/bin/posh -kc fibre --type=infra
$n $fabric/bin/posh -kc fibre
Now connect to the infrastructure fibre and import/deploy the gateway system.
%0 fabric connect localhost:9101
%0 sh gateway.scripts/systems/gateway.osh
%0 fabric status -S gateway.system
Now use the gateway cli to connect and request some quotes
%0 sh gateway.scripts/services/client.osh
%0 gateway testbatch --batchSize=10000 --batchCount=10 --requestTimeout=60000