Skip to content

Commit f97bd8c

Browse files
authored
Merge pull request #26 from bigchaindb/BEP-14-impl
Fix #18 - implemented BEP-14 with backward compatibility and tests
2 parents cae61d8 + c0b78c7 commit f97bd8c

File tree

12 files changed

+1943
-97
lines changed

12 files changed

+1943
-97
lines changed

.README.md.html

Lines changed: 914 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ then
5050

5151
```
5252
dependencies {
53-
compile 'com.bigchaindb.bigchaindb-driver:1.0'
53+
implementation 'com.bigchaindb.bigchaindb-driver:1.2'
5454
}
5555
5656
```
@@ -66,13 +66,58 @@ then
6666
### Set up your configuration
6767
- If you don't have app-id and app-key, you can register one at [https://testnet.bigchaindb.com/](https://testnet.bigchaindb.com/)
6868

69+
#### single node setup
6970
```java
7071
BigchainDbConfigBuilder
7172
.baseUrl("https://test.bigchaindb.com/")
7273
.addToken("app_id", <your-app-id>)
7374
.addToken("app_key", <your-app-key>).setup();
7475
```
76+
#### multi-node setup (more robust and reliable)
77+
> **Note** - multi-node setup is only available in version 1.2 and later
78+
> **Assumption** -This setup assumes that defined multiple nodes are all connected within same BigchainDB network
7579
80+
```java
81+
//define connections
82+
Map<String, Object> conn1Config = new HashMap<String, Object>(),
83+
conn2Config = new HashMap<String, Object>();
84+
85+
//defien headers for connections
86+
Map<String, String> headers1 = new HashMap<String, String>();
87+
Map<String, String> headers2 = new HashMap<String, String>();
88+
89+
//config header for connection 1
90+
headers1.put("app_id", "<your-app-id>");
91+
headers1.put("app_key", "<your-app-key>");
92+
93+
//config header for connection 2
94+
headers2.put("app_id", "<your-app-id>");
95+
headers2.put("app_key", "<your-app-key>");
96+
97+
//config connection 1
98+
conn1Config.put("baseUrl", "https://node1.mysite.com/");
99+
conn1Config.put("headers", headers1);
100+
Connection conn1 = new Connection(conn1Config);
101+
102+
//config connection 2
103+
conn2Config.put("baseUrl", "https://node2.mysite.com/");
104+
conn2Config.put("headers", headers2);
105+
Connection conn2 = new Connection(conn2Config);
106+
107+
//add connections
108+
List<Connection> connections = new ArrayList<Connection>();
109+
connections.add(conn1);
110+
connections.add(conn2);
111+
//...You can add as many nodes as you want
112+
113+
BigchainDbConfigBuilder
114+
.addConnections(connections)
115+
.setTimeout(60000) //override default timeout of 20000 milliseconds
116+
.setup();
117+
118+
}
119+
120+
```
76121
### Example: Prepare keys, assets and metadata
77122
```java
78123
// prepare your keys

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>com.bigchaindb</groupId>
88
<artifactId>bigchaindb-driver</artifactId>
9-
<version>1.1</version>
9+
<version>1.2</version>
1010
<packaging>jar</packaging>
1111

1212
<name>bigchaindb-driver</name>

0 commit comments

Comments
 (0)