@@ -6,40 +6,11 @@ This section shows the necessary settings for connecting to instances with a use
66stored functions or Cartridge roles implementing the API similar to the one of [ tarantool/crud] ( https://github.com/tarantool/crud ) .
77Works with ` tarantool/crud ` 0.3.0+.
88
9- See an example of how to set up a proxy client working with ` tarantool/crud ` :
9+ Example of TarantoolClient set up
10+ https://github.com/tarantool/cartridge-java/blob/67536ed2478794c414f7d0b291eaa5d35742fe4a/src/test/java/io/tarantool/driver/integration/ProxyTarantoolClientExampleIT.java#L45-L55
1011
11- ``` java
12- class Scratch {
13- public static void main (String [] args ) {
12+ Example of client API usage
13+ https://github.com/tarantool/cartridge-java/blob/8d094b784864ccf74a472fdd4f9419714374ca0b/src/test/java/io/tarantool/driver/integration/ProxyTarantoolClientExampleIT.java#L63-L104
1414
15- TarantoolClient<TarantoolTuple , TarantoolResult<TarantoolTuple > > client = TarantoolClientFactory . createClient()
16- .withAddress(" 123.123.123.1" )
17- // use the value of cluster_cookie parameter in the init.lua file in your Cartridge application
18- .withCredentials(" admin" , " secret-cluster-cookie" )
19- .withProxyMethodMapping()
20- // also you may use a lambda function for specifying the proxy methods' names
21- .withProxyMethodMapping(builder - > builder. withSelectFunctionName(" customSelect" ))
22- .build();
23-
24- TarantoolSpaceOperations<TarantoolTuple , TarantoolResult<TarantoolTuple > > testSpace = client. space(" testSpace" );
25-
26- // Use TarantoolTupleFactory for instantiating new tuples
27- TarantoolTupleFactory tupleFactory = new DefaultTarantoolTupleFactory (client. getConfig(). getMessagePackMapper());
28- // Pass the field corresponding to bucket_id as null for tarantool/crud to compute it automatically
29- TarantoolTuple tuple = tupleFactory. create(1_000_000 , null , " profile_name" );
30- // Primary index key value will be determined from the tuple
31- Conditions conditions = Conditions . after(tuple);
32- TarantoolResult<TarantoolTuple > updateResult = testSpace. update(conditions, tuple). get();
33-
34- Conditions conditions = Conditions . greaterOrEquals(" profile_id" , 1_000_000 );
35- // crud.select(...) on the Cartridge router will be called internally
36- TarantoolResult<TarantoolTuple > selectResult = testSpace. select(conditions). get();
37- assertEquals(20 , selectResult. size());
38-
39- // Any other operations with tuples as described in the examples above
40- ...
41-
42- client. close();
43- }
44- }
45- ```
15+ You can read more about Cartridge applications in its [ documentation] ( https://www.tarantool.io/ru/doc/latest/how-to/getting_started_cartridge/ ) .
16+ Also look at available Cartridge application [ examples] ( https://github.com/tarantool/examples ) .
0 commit comments