reactive java web-framework
quebic contains non-blocking web server. You can develop micro services by using quebic and you can communicate with each services easily. quebic have inbuilt Clustering and Load-Balancing mechanism. more
- JDK 1.8.X
- Maven 3.3.X
- Remote repository.
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<id>quebic_repo</id>
<name>quebic_repo</name>
<url>http://quebic.io/static/repo</url>
<layout>default</layout>
</repository>
</repositories>
- Add dependency.
<dependency>
<groupId>com.lovi.quebic</groupId>
<artifactId>quebic-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
- Download the sample-application
- Build the application using mvn package
- Run the application using java -jar target\sample-app-0.0.1-SNAPSHOT.jar
- Consume web app from localhost:8080
@SpringBootApplication
public class App
{
private final static Logger logger = LoggerFactory.getLogger(App.class);
public static void main( String[] args )
{
AppLauncher appLauncher = AppLauncher.create();
appLauncher.run(App.class, 8080,r->{
logger.info(r);
}, fail->{
logger.error(fail.getMessage());
}, args);
}
}
@Controller
@RequestMapping("/users")
public class UserController {
@Autowired
private UserService userService;
@RequestMapping
public void findAll(ApplicationContextData contextData, Response response) throws JsonParserException{
response.writePOJO(userService.findAll(contextData));
}
@RequestMapping(value="/{id}")
public void findById(@PathVariable("id") Integer id, ApplicationContextData contextData, Response response) throws JsonParserException{
User user = userService.findById(contextData, id);
response.writePOJO(user);
}
@RequestMapping(method=HttpMethod.POST)
public void save(@ModelAttribute User user, ApplicationContextData contextData, Response response) throws JsonParserException{
userService.save(contextData, user);
response.setResponseCode(201);
response.writePOJO(user);
}
....
}
- Use
com.lovi.quebic.annotation.Controller
- Implementation of the controllers are similar to the spring-mvc but remember internal architecture of the queubic is totally different from spring-mvc
- value = The primary mapping expressed by this annotation
- method = The HTTP request methods
- consumes = The consumable media types of the mapped request
- produce = The producible media types of the mapped request
Response.write(byte[] value)
set response valueResponse.writPOJO(Object value)
write java POJO as response.