Giter Club home page Giter Club logo

netty-spring-example-with-jpa's Introduction

Netty-spring-example with JPA

TCP communication server with Netty, spring-boot, spring-data-jpa

This TCP Communication Service is a simple example for developer who want to make tcp service with Spring-Boot, Spring-Data-JPA and Netty.

Feature

  • Telnet Client can send message to other telnet client.
  • Telnet Client can retrieve User Information from RDBMS(H2 DB).

Install

This example uses embedded DBMS(h2 db). So, you don't need to install any DBMS. But you have to use below DDL and DML.

CREATE TABLE USER
(
    ID BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL,
    PHONE_NUMBER VARCHAR(255),
    USERNAME VARCHAR(255),
    USE_YN BOOLEAN DEFAULT TRUE
);
CREATE UNIQUE INDEX UK_SB8BBOUER5WAK8VYIIY4PF2BX_INDEX_2 ON USER (USERNAME);
INSERT INTO PUBLIC.USER (ID, PHONE_NUMBER, USERNAME, USE_YN) VALUES (1, '010-1111-2222', 'zbum', true);
INSERT INTO PUBLIC.USER (ID, PHONE_NUMBER, USERNAME, USE_YN) VALUES (2, '010-1111-3333', 'manty', true);
INSERT INTO PUBLIC.USER (ID, PHONE_NUMBER, USERNAME, USE_YN) VALUES (3, '010-1111-4444', 'jibumjung', true);

How to use

  • Run com.zbum.example.socket.server.netty.Application with IDE or Maven
    $ mvn spring-boot:run
  • Connect to this server by telnet command.
    $ telnet localhost 8090
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    Your channel key is /0:0:0:0:0:0:0:1:57220
  • Your channel key (ID) is /0:0:0:0:0:0:0:1:57220
  • Connect to this server by telnet command on annother terminal.
    $ telnet localhost 8090
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    Your channel key is /0:0:0:0:0:0:0:1:57221
  • From now, you can send message to /0:0:0:0:0:0:0:1:57220 channel by below
    /0:0:0:0:0:0:0:1:57220::I Love You!!!
  • Then, you can receive Message like below
    $ telnet localhost 8090
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    Your channel key is /0:0:0:0:0:0:0:1:57220
    I Love You!!!
  • Then, you can retrieve user data by command below.
    $ telnet localhost 8090
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    Your channel key is /0:0:0:0:0:0:0:1:63390
    name?zbum
    010-1111-2222
    name?manty
    010-1111-3333
    name?all
    zbum:010-1111-2222
    manty:010-1111-3333

netty-spring-example-with-jpa's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.