Skip to content

Commit 8b96d5a

Browse files
Merge branch 'master' into mongodb-exchange-store-yaml-example
2 parents c981cd8 + 481e293 commit 8b96d5a

21 files changed

Lines changed: 283 additions & 113 deletions

core/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,12 @@
397397
<artifactId>log4j-slf4j2-impl</artifactId>
398398
<scope>provided</scope>
399399
</dependency>
400+
<dependency>
401+
<groupId>jakarta.annotation</groupId>
402+
<artifactId>jakarta.annotation-api</artifactId>
403+
<version>2.1.1</version>
404+
<scope>compile</scope>
405+
</dependency>
400406
</dependencies>
401407

402408
<build>

core/src/main/java/com/predic8/membrane/core/router/DefaultMainComponents.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ public class DefaultMainComponents implements MainComponents {
4747
private final TimerManager timerManager = new TimerManager();
4848
private final HttpClientFactory httpClientFactory = new HttpClientFactory(timerManager);
4949
private final KubernetesClientFactory kubernetesClientFactory = new KubernetesClientFactory(httpClientFactory);
50-
protected ResolverMap resolverMap;
50+
private final ResolverMap resolverMap;
51+
52+
private final FlowController flowController;
53+
private final RuleManager ruleManager;
5154

5255
protected final Statistics statistics = new Statistics();
5356

@@ -57,6 +60,9 @@ public DefaultMainComponents(DefaultRouter router) {
5760
this.router = router;
5861
resolverMap = new ResolverMap(httpClientFactory, kubernetesClientFactory);
5962
resolverMap.addRuleResolver(router);
63+
flowController = new FlowController(router);
64+
ruleManager= new RuleManager();
65+
ruleManager.setRouter(router);
6066
}
6167

6268
public void init() {
@@ -67,19 +73,7 @@ public void init() {
6773
}
6874

6975
registry.registerIfAbsent(HttpClientConfiguration.class, HttpClientConfiguration::new);
70-
71-
registry.registerIfAbsent(ResolverMap.class, () -> {
72-
ResolverMap rs = new ResolverMap(httpClientFactory, kubernetesClientFactory);
73-
rs.addRuleResolver(router);
74-
return rs;
75-
});
76-
7776
registry.registerIfAbsent(ExchangeStore.class, LimitedMemoryExchangeStore::new);
78-
registry.registerIfAbsent(RuleManager.class, () -> {
79-
RuleManager rm = new RuleManager();
80-
rm.setRouter(router);
81-
return rm;
82-
});
8377
registry.registerIfAbsent(DNSCache.class, DNSCache::new);
8478

8579
// Transport last
@@ -98,11 +92,7 @@ public void setRules(Collection<Proxy> proxies) {
9892

9993
@Override
10094
public RuleManager getRuleManager() {
101-
return getRegistry().registerIfAbsent(RuleManager.class, () -> {
102-
RuleManager rm = new RuleManager();
103-
rm.setRouter(router);
104-
return rm;
105-
});
95+
return ruleManager;
10696
}
10797

10898
public void setApplicationContext(ApplicationContext ctx) throws BeansException {
@@ -177,7 +167,7 @@ public HttpClientFactory getHttpClientFactory() {
177167
}
178168

179169
public FlowController getFlowController() {
180-
return getRegistry().registerIfAbsent(FlowController.class, () -> new FlowController(router));
170+
return flowController;
181171
}
182172

183173
public void setRegistry(BeanRegistry registry) {

distribution/tutorials/advanced/10-PathParameters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# 1.) Start Membrane:
77
#
8-
# membrane.sh -c 10-PathParameters.yaml
8+
# ./membrane.sh -c 10-PathParameters.yaml
99
#
1010
# 2.) Call the API:
1111
#
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# Advanced Membrane Tutorial
22

3-
In this tutorial you will learn advanced features of Membrane, including:
3+
This tutorial introduces advanced Membrane API Gateway features, including:
44

55
- Path parameters
66
- Routing
77
- Rewriting of paths
88
- Redirects
99

10-
Before starting, we recommend completing the [Getting Started](../getting-started) tutorial.
10+
Before you start, make sure you have completed the
11+
[Getting Started](../getting-started) tutorial.
12+
13+
To begin, open [10-PathParameters.yaml](10-PathParameters.yaml) and follow the instructions in the file.
14+
15+
More examples are available in the examples folder.
16+
17+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<books>
3+
4+
<book id="29">
5+
<title>The API Gateway Handbook - Second Edition</title>
6+
<author>Thomas Bayer</author>
7+
<author>Tobias Polley</author>
8+
<year>Not released yet</year>
9+
<category>APIs</category>
10+
</book>
11+
12+
</books>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<books>
3+
4+
<book id="29">
5+
<title>The API Gateway Handbook</title>
6+
<author>Thomas Bayer</author>
7+
<author>Tobias Polley</author>
8+
<year>2025</year>
9+
<category>APIs</category>
10+
</book>
11+
12+
</books>
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<books>
3+
4+
<book id="1">
5+
<title>The Mythical Man-Month</title>
6+
<author>Frederick P. Brooks Jr.</author>
7+
<year>1975</year>
8+
<category>Software Engineering</category>
9+
</book>
10+
11+
<book id="2">
12+
<title>Code Complete</title>
13+
<author>Steve McConnell</author>
14+
<year>1993</year>
15+
<category>Software Engineering</category>
16+
</book>
17+
18+
<book id="3">
19+
<title>Clean Code</title>
20+
<author>Robert C. Martin</author>
21+
<year>2008</year>
22+
<category>Software Engineering</category>
23+
</book>
24+
25+
<book id="4">
26+
<title>The Pragmatic Programmer</title>
27+
<author>Andrew Hunt</author>
28+
<author>David Thomas</author>
29+
<year>1999</year>
30+
<category>Software Engineering</category>
31+
</book>
32+
33+
<book id="5">
34+
<title>Design Patterns</title>
35+
<subtitle>Elements of Reusable Object-Oriented Software</subtitle>
36+
<author>Erich Gamma</author>
37+
<author>Richard Helm</author>
38+
<author>Ralph Johnson</author>
39+
<author>John Vlissides</author>
40+
<year>1994</year>
41+
<category>Architecture</category>
42+
</book>
43+
44+
<book id="6">
45+
<title>Patterns of Enterprise Application Architecture</title>
46+
<author>Martin Fowler</author>
47+
<year>2002</year>
48+
<category>Architecture</category>
49+
</book>
50+
51+
<book id="7">
52+
<title>Structure and Interpretation of Computer Programs</title>
53+
<author>Harold Abelson</author>
54+
<author>Gerald Jay Sussman</author>
55+
<year>1985</year>
56+
<category>Computer Science</category>
57+
</book>
58+
59+
<book id="8">
60+
<title>The Art of Unix Programming</title>
61+
<author>Eric S. Raymond</author>
62+
<year>2003</year>
63+
<category>Systems</category>
64+
</book>
65+
66+
<book id="9">
67+
<title>Site Reliability Engineering</title>
68+
<subtitle>How Google Runs Production Systems</subtitle>
69+
<author>Betsy Beyer</author>
70+
<author>Chris Jones</author>
71+
<author>Jennifer Petoff</author>
72+
<author>Niall Richard Murphy</author>
73+
<year>2016</year>
74+
<category>DevOps</category>
75+
</book>
76+
77+
<book id="10">
78+
<title>The Phoenix Project</title>
79+
<subtitle>A Novel About IT, DevOps, and Helping Your Business Win</subtitle>
80+
<author>Gene Kim</author>
81+
<author>Kevin Behr</author>
82+
<author>George Spafford</author>
83+
<year>2013</year>
84+
<category>DevOps</category>
85+
</book>
86+
87+
</books>
File renamed without changes.

distribution/tutorials/json/60-Json-Transformation.yaml renamed to distribution/tutorials/json/20-Json-Transformation.yaml

File renamed without changes.
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
# Membrane API Gateway Tutorial - JSON
22

3-
Before starting, we recommend completing the [Getting Started](../getting-started) tutorial.
3+
This tutorial covers working with JSON in Membrane API Gateway, including:
4+
5+
- JsonPath
6+
- JSON message transformations
7+
8+
To begin, open [10-JSONPath.yaml](10-JSONPath.yaml) and follow the instructions in the file.
9+
10+
More examples are available in the examples folder.

0 commit comments

Comments
 (0)