Skip to content

Instantly share code, notes, and snippets.

View haigopi's full-sized avatar
💭
Who loves to code!

Gopi haigopi

💭
Who loves to code!
View GitHub Profile
<dependency>
<groupId>com.lightbend.lagom</groupId>
<artifactId>lagom-maven-dependencies</artifactId>
<version>${lagom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<plugin>
<groupId>com.lightbend.lagom</groupId>
<artifactId>lagom-maven-plugin</artifactId>
<version>${lagom.version}</version>
</plugin>
GET: http://localhost:9000/api/hello/AliceInWonderland
Result: Hello, AliceInWonderland!
POST: curl -H "Content-Type: application/json" -X POST -d '{"mssage": "Hi"}' http://localhost:9000/api/hello/TestMe
Result: { "done": true }
return named("hellooo").withCalls(
pathCall("/api/hello/:id", this::hello),
pathCall("/api/hello/:id", this::useGreeting)).
withTopics(topic("hello-events", this::helloEvents).
withProperty(KafkaProperties.partitionKeyStrategy(), HelloEvent:: getName)).withAutoAcl(true);
[INFO] Service hello-impl listening for HTTP on 0:0:0:0:0:0:0:0:57797
[INFO] Service stream-impl listening for HTTP on 0:0:0:0:0:0:0:0:58445
[INFO] (Services started, press enter to stop and go back to the console…)
org.example.allibilli.hello.impl.HelloServiceImpl [] - Streaming....HelloEvent.GreetingMessageChanged(name=Gopi, message=Gopi), 038caf70-7582-11e8-bb88-53b56a828326
org.example.allibilli.hello.impl.HelloServiceImpl [] - Streaming....HelloEvent.GreetingMessageChanged(name=Gopi, message=Topi), 209b5850-7582-11e8-bb88-53b56a828326
org.example.allibilli.hello.impl.HelloServiceImpl [] - Streaming....HelloEvent.GreetingMessageChanged(name=Gopi, message=Krishna), 43465080-7582-11e8-bb88-53b56a828326
Feature: A simple payload that can kick off the API
Background:
* url baseURL+'/test'
* configure headers = read('classpath:headers.js')
* def payload = read('payload.json')
Scenario: Create and Retrieve a menu by Id
And request payload
[ http-nio-8080-exec-2] 2018-07-14 19:12:24 INFO com.allibilli.nio.api.AppService - ASYNC + SYNC POST:
[ http-nio-8080-exec-2] 2018-07-14 19:12:24 INFO com.allibilli.nio.async.AsyncMaker - POST: ASync Request: https://reqres.in/api/users - {"name": "Gopi","job": "Engineer"}
[ http-nio-8080-exec-2] 2018-07-14 19:12:25 INFO com.allibilli.nio.async.AsyncMaker - POST: ASync Request: https://reqres.in/api/users - {"name": "Gopi","job": "Engineer"}
[ http-nio-8080-exec-2] 2018-07-14 19:12:25 INFO com.allibilli.nio.async.AsyncMaker - POST: ASync Request: https://reqres.in/api/users - {"name": "Gopi","job": "Engineer"}
[ http-nio-8080-exec-2] 2018-07-14 19:12:25 INFO com.allibilli.nio.async.AsyncMaker - POST: ASync Request: https://reqres.in/api/users - {"name": "Gopi","job": "Engineer"}
[ http-nio-8080-exec-2] 2018-07-14 19:12:25 INFO com.allibilli.nio.async.AsyncMaker - POST: ASync Request: https://reqres.in/api/users - {"name": "Gopi","job": "Engineer"}
[ http-nio-8
public void initiateOutboundSyncReactor(ConcurrentLinkedQueue<Tuple3<String, String, HttpMethod>> q) {
simpleReact.
from(q.stream().map(it -> syncMaker.call(q.poll()))).
then(resp -> syncMaker.handleSyncResponse(resp)).
onFail(e -> syncMaker.handleError(e, e.getValue()));
}
public void createGetQ(){
for (int i = 0; i <= 10; ++i) {
Tuple3<String, String, HttpMethod> getTuple = new Tuple3("https://reqres.in/api/users/2?delay=3", payload, HttpMethod.GET);
get.add(getTuple);
}
}