O JBoss EAP 7 Beta já está disponível liberadoParabéns à Red Hat e, particularmente, à equipe de WildFly equipe! Há muitos aprimoramentos nesta versão, conforme documentado em Notas de lançamento. Um dos principais temas é a conformidade com o Java EE 7.
JBoss EAP 7 e Java EE 7
A IBM e a Oracle já fornecem servidores de aplicativos compatíveis com Java EE 7 com suporte comercial. E agora a Red Hat também se juntará a essa festa em breve. Embora a WildFly tenha oferecido suporte ao Java EE 7 por mais de dois anos, o suporte comercial é fundamental para que o código aberto seja adotado em toda a empresa. Portanto, essa é uma boa notícia! Você pode saber tudo sobre os diferentes APIs do Java EE 7 no DZone Refcardz que eu criei junto com @alrubinger.

Há muitos "hello world" Amostras do Java EE 7 que devem ser executados com o JBoss EAP. Esperamos que alguém atualize o pom.xml e adicionar um novo perfil.
Por que NoSQL?
Se você estiver criando um aplicativo corporativo tradicional, talvez não tenha problemas em usar um RDBMS. Há muitas vantagens em usar RDBMS, mas usar um banco de dados NoSQL tem algumas vantagens:
- Não há necessidade de ter um esquema predefinido, o que os torna um banco de dados sem esquema. A adição de novas propriedades a objetos existentes é fácil e não requer ALTER TABLE. As dados não estruturados oferece flexibilidade para alterar o formato dos dados a qualquer momento, sem tempo de inatividade ou níveis de serviço reduzidos. Além disso, não há junções acontecendo no servidor porque não há estrutura e, portanto, não há relação entre elas.
- Escalabilidade, agilidade e desempenho é mais importante do que todo o conjunto de funcionalidades normalmente fornecidas por um RDBMS. Esse conjunto de bancos de dados oferece consistência eventual e/ou transações restritas a itens únicos, mas com mais foco no CRUD.
- Os NoSQL são projetados para aumento de escala (horizontal) em vez de aumento de escala (vertical). Isso é importante sabendo que os bancos de dados, e todo o resto também, estão se movendo para a nuvem. O RBDMS pode ser ampliado usando sharding, mas requer um gerenciamento complexo e não é para os fracos de coração. As consultas que exigem JOINs entre shards são extremamente ineficiente.
- Os RDBMS têm incompatibilidade de impedância entre a estrutura do banco de dados e as classes de domínio. Nesse caso, é necessário um mapeamento objeto-relacional, como o fornecido pela Java Persistence API ou pelo Hibernate.
- Os bancos de dados NoSQL são projetados para ter menos gerenciamento e modelos de dados mais simples levam a menor custo administrativo também.
Então, agora você está entusiasmado com o NoSQL e quer saber mais:
- Por que NoSQL?
- Por que as empresas bem-sucedidas confiam no NoSQL?
- Os 10 principais casos de uso de NoSQL empresarial
Em resumo, há quatro tipos diferentes de bancos de dados NoSQL:
- Documento: Couchbase, Mongo e outros
- Chave/Valor: Couchbase, Redis e outros
- Gráfico: Neo4J, OrientDB e outros
- Coluna: Cassandra e outros
O Java EE 7 fornece a Java Persistence API, que não oferece nenhum suporte para NoSQL. Então, como você pode começar a usar o NoSQL com o JBoss EAP 7? Este blog mostrará como consultar um banco de dados Couchbase usando um aplicativo Java EE simples implantado no JBoss EAP 7 Beta.
O que é o Couchbase?
Couchbase é um banco de dados de documentos NoSQL de código aberto. Ele permite acessar, indexar e consultar documentos JSON, aproveitando o cache distribuído integrado para acesso a dados de alto desempenho. Os desenvolvedores podem escrever aplicativos para o Couchbase usando diferentes linguagens (Java, Go, .NET, Node, PHP, Python, C) vários SDKs. Este blog mostrará como você pode criar facilmente um aplicativo CRUD usando Java SDK para Couchbase.
Executar o JBoss EAP 7
Há duas maneiras de iniciar o JBoss EAP 7.
Baixar e executar
- Baixar JBoss EAP 7 Beta e descompactar.
- Inicie o servidor de aplicativos como:
1234567891011121314151617181920./jboss-eap-7.0/bin/standalone.sh=========================================================================JBoss Bootstrap EnvironmentJBOSS_HOME: /Users/arungupta/tools/jboss-eap-7.0JAVA: javaJAVA_OPTS: -server -verbose:gc -Xloggc:"/Users/arungupta/tools/jboss-eap-7.0/standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true=========================================================================21:22:58,773 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.4.Final-redhat-1. . .21:23:21,441 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on https://127.0.0.1:9990/management21:23:21,442 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on https://127.0.0.1:999021:23:21,442 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: EAP 7.0.0.Beta1 (WildFly Core 2.0.3.Final-redhat-1) started in 22950ms - Started 261 of 509 services (332 services are lazy, passive or on-demand)
Execução do Docker
Em um mundo em contêineres, basta execução do docker para executar o JBoss EAP. No entanto, a imagem do JBoss EAP não existe no Docker Hub e, portanto, a imagem precisa ser criada explicitamente. Você ainda precisa fazer o download explícito do JBoss EAP e, em seguida, usar o seguinte Dockerfile para criar a imagem:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# Use latest jboss/base-jdk:8 image as the base FROM jboss/base-jdk:8 # Set the JBOSS_VERSION env variable ENV JBOSS_VERSION 7.0.0.Beta ENV JBOSS_HOME /opt/jboss/jboss-eap-7.0/ COPY jboss-eap-$JBOSS_VERSION.zip $HOME # Add the JBoss distribution to /opt, and make jboss the owner of the extracted zip content # Make sure the distribution is available from a well-known place RUN cd $HOME && unzip jboss-eap-$JBOSS_VERSION.zip && rm jboss-eap-$JBOSS_VERSION.zip # Ensure signals are forwarded to the JVM process correctly for graceful shutdown ENV LAUNCH_JBOSS_IN_BACKGROUND true # Expose the ports we're interested in EXPOSE 8080 9990 # Set the default command to run on boot # This will boot JBoss EAP in the standalone mode and bind to all interface CMD ["/opt/jboss/jboss-eap-7.0/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] |
A imagem é construída como:
|
1 |
docker build -t arungupta/jboss-eap:7-beta . |
E então você pode executar o contêiner do JBoss EAP 7 como:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
docker run -it -p 8080:8080 arungupta/jboss-eap:7-beta ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /opt/jboss/jboss-eap-7.0/ JAVA: /usr/lib/jvm/java/bin/java JAVA_OPTS: -server -verbose:gc -Xloggc:"/opt/jboss/jboss-eap-7.0//standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true ========================================================================= 20:51:12,551 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.4.Final-redhat-1 20:51:12,824 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final-redhat-1 . . . 20:51:16,750 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on https://0.0.0.0:9990/management 20:51:16,758 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on https://0.0.0.0:9990 20:51:16,759 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: EAP 7.0.0.Beta1 (WildFly Core 2.0.3.Final-redhat-1) started in 4529ms - Started 261 of 509 services (332 services are lazy, passive or on-demand) |
Observe como as portas de aplicativo e gerenciamento estão vinculadas a todas as interfaces de rede. Isso simplificará a implementação do aplicativo nessa instância do JBoss EAP mais tarde. Pare o servidor, pois mostraremos uma maneira mais fácil de iniciá-lo mais tarde.
Iniciar o servidor de aplicativos e o banco de dados
O aplicativo Java EE fornecerá uma interface HTTP CRUD sobre documentos JSON armazenados no Couchbase. O aplicativo em si será implantado no JBoss EAP 7 Beta. Portanto, será necessário iniciar o Couchbase e o JBoss EAP. Use o arquivo Docker Compose de github.com/arun-gupta/docker-images/blob/master/jboss-eap7-nosql/docker-compose.yml para iniciar o contêiner do Couchbase e do JBoss EAP 7:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
mycouchbase: container_name: "db" image: couchbase/server ports: - 8091:8091 - 8092:8092 - 8093:8093 - 11210:11210 jboss: image: arungupta/jboss-eap:7-beta environment: - COUCHBASE_URI=db ports: - 8080:8080 - 9990:9990 |
O aplicativo é iniciado como:
|
1 2 3 4 |
docker-compose --x-networking up -d Creating network "jbosseap7nosql" with driver "None" Starting jbosseap7nosql_jboss_1 Creating db |
Os contêineres iniciados podem ser vistos como:
|
1 2 3 4 |
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 154436dfbfb1 couchbase/server "/entrypoint.sh couch" 10 seconds ago Up 8 seconds 0.0.0.0:8091-8093->8091-8093/tcp, 11207/tcp, 11211/tcp, 18091-18092/tcp, 0.0.0.0:11210->11210/tcp db cb76d4e38df3 arungupta/jboss-eap:7-beta "/opt/jboss/jboss-eap" 10 seconds ago Up 9 seconds 0.0.0.0:8080->8080/tcp, 0.0.0.0:9990->9990/tcp jbosseap7nosql_jboss_1 |
Configurar o servidor Couchbase
Clone couchbase-javaee aplicativo. Esse aplicativo Java EE usa APIs do SDK Java do Couchbase para se conectar ao servidor Couchbase. O código de bootstrap é:
|
1 |
CouchbaseCluster.create(System.getenv("COUCHBASE_URI")); |
e é invocado a partir de Abstração de banco de dados. O Couchbase Server pode ser configurado usando API REST. Essas APIs REST são definidas em um perfil Maven em pom.xml desse aplicativo. Portanto, configure o servidor Couchbase como:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
mvn install -Pcouchbase -Ddocker.host=$(docker-machine ip couchbase) [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building couchbase-javaee 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/arungupta/workspaces/couchbase-javaee/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ couchbase-javaee --- [INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ couchbase-javaee --- [INFO] Packaging webapp [INFO] Assembling webapp [couchbase-javaee] in [/Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee] [INFO] Processing war project [INFO] Copying webapp resources [/Users/arungupta/workspaces/couchbase-javaee/src/main/webapp] [INFO] Webapp assembled in [82 msecs] [INFO] Building war: /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ couchbase-javaee --- [INFO] Installing /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war to /Users/arungupta/.m2/repository/org/couchbase/sample/couchbase-javaee/1.0-SNAPSHOT/couchbase-javaee-1.0-SNAPSHOT.war [INFO] Installing /Users/arungupta/workspaces/couchbase-javaee/pom.xml to /Users/arungupta/.m2/repository/org/couchbase/sample/couchbase-javaee/1.0-SNAPSHOT/couchbase-javaee-1.0-SNAPSHOT.pom [INFO] [INFO] --- exec-maven-plugin:1.4.0:exec (Configure memory) @ couchbase-javaee --- * Hostname was NOT found in DNS cache * Trying 192.168.99.102... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.99.102 (192.168.99.102) port 8091 (#0) > POST /pools/default HTTP/1.1 > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8091 > Accept: */* > Content-Length: 36 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 36 out of 36 bytes < HTTP/1.1 200 OK * Server Couchbase Server is not blacklisted < Server: Couchbase Server < Pragma: no-cache < Date: Mon, 21 Dec 2015 21:35:10 GMT < Content-Length: 0 < Cache-Control: no-cache < 100 36 0 0 100 36 0 15510 --:--:-- --:--:-- --:--:-- 18000 * Connection #0 to host 192.168.99.102 left intact [INFO] [INFO] --- exec-maven-plugin:1.4.0:exec (Configure services) @ couchbase-javaee --- * Hostname was NOT found in DNS cache * Trying 192.168.99.102... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.99.102 (192.168.99.102) port 8091 (#0) > POST /node/controller/setupServices HTTP/1.1 > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8091 > Accept: */* > Content-Length: 26 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 26 out of 26 bytes < HTTP/1.1 200 OK * Server Couchbase Server is not blacklisted < Server: Couchbase Server < Pragma: no-cache < Date: Mon, 21 Dec 2015 21:35:10 GMT < Content-Length: 0 < Cache-Control: no-cache < 100 26 0 0 100 26 0 9976 --:--:-- --:--:-- --:--:-- 13000 * Connection #0 to host 192.168.99.102 left intact [INFO] [INFO] --- exec-maven-plugin:1.4.0:exec (Setup credentials) @ couchbase-javaee --- * Hostname was NOT found in DNS cache * Trying 192.168.99.102... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.99.102 (192.168.99.102) port 8091 (#0) > POST /settings/web HTTP/1.1 > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8091 > Accept: */* > Content-Length: 50 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 50 out of 50 bytes < HTTP/1.1 200 OK * Server Couchbase Server is not blacklisted < Server: Couchbase Server < Pragma: no-cache < Date: Mon, 21 Dec 2015 21:35:10 GMT < Content-Type: application/json < Content-Length: 44 < Cache-Control: no-cache < { [data not shown] 100 94 100 44 100 50 6880 7818 --:--:-- --:--:-- --:--:-- 8333 * Connection #0 to host 192.168.99.102 left intact {"newBaseUri":"https://192.168.99.102:8091/"}[INFO] [INFO] --- exec-maven-plugin:1.4.0:exec (Install travel-sample bucket) @ couchbase-javaee --- * Hostname was NOT found in DNS cache * Trying 192.168.99.102... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.99.102 (192.168.99.102) port 8091 (#0) * Server auth using Basic with user 'Administrator' > POST /sampleBuckets/install HTTP/1.1 > Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA== > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8091 > Accept: */* > Content-Length: 17 > Content-Type: application/x-www-form-urlencoded > } [data not shown] * upload completely sent off: 17 out of 17 bytes < HTTP/1.1 202 Accepted * Server Couchbase Server is not blacklisted < Server: Couchbase Server < Pragma: no-cache < Date: Mon, 21 Dec 2015 21:35:11 GMT < Content-Type: application/json < Content-Length: 2 < Cache-Control: no-cache < { [data not shown] 100 19 100 2 100 17 41 355 --:--:-- --:--:-- --:--:-- 361 * Connection #0 to host 192.168.99.102 left intact [][INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.094 s [INFO] Finished at: 2015-12-21T13:35:11-08:00 [INFO] Final Memory: 13M/309M [INFO] ------------------------------------------------------------------------ |
Implantar o aplicativo Java EE no JBoss
O aplicativo Java EE pode ser facilmente implantado no JBoss EAP 7 Beta usando o Plug-in WildFly Maven. Isso também é definido como um perfil Maven em pom.xml também. Implemente o aplicativo como:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
mvn install -Pwildfly -Dwildfly.hostname=$(docker-machine ip couchbase) -Dwildfly.username=admin -Dwildfly.password=Admin#007 [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building couchbase-javaee 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/arungupta/workspaces/couchbase-javaee/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ couchbase-javaee --- [INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ couchbase-javaee --- [INFO] Packaging webapp [INFO] Assembling webapp [couchbase-javaee] in [/Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee] [INFO] Processing war project [INFO] Copying webapp resources [/Users/arungupta/workspaces/couchbase-javaee/src/main/webapp] [INFO] Webapp assembled in [62 msecs] [INFO] Building war: /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ couchbase-javaee --- [INFO] Installing /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war to /Users/arungupta/.m2/repository/org/couchbase/sample/couchbase-javaee/1.0-SNAPSHOT/couchbase-javaee-1.0-SNAPSHOT.war [INFO] Installing /Users/arungupta/workspaces/couchbase-javaee/pom.xml to /Users/arungupta/.m2/repository/org/couchbase/sample/couchbase-javaee/1.0-SNAPSHOT/couchbase-javaee-1.0-SNAPSHOT.pom [INFO] [INFO] >>> wildfly-maven-plugin:1.1.0.Alpha4:deploy (default) > package @ couchbase-javaee >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ couchbase-javaee --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/arungupta/workspaces/couchbase-javaee/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ couchbase-javaee --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ couchbase-javaee --- [INFO] Skipping execution of surefire because it has already been run for this configuration [INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ couchbase-javaee --- [INFO] Packaging webapp [INFO] Assembling webapp [couchbase-javaee] in [/Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee] [INFO] Processing war project [INFO] Copying webapp resources [/Users/arungupta/workspaces/couchbase-javaee/src/main/webapp] [INFO] Webapp assembled in [20 msecs] [INFO] Building war: /Users/arungupta/workspaces/couchbase-javaee/target/couchbase-javaee.war [INFO] [INFO] <<< wildfly-maven-plugin:1.1.0.Alpha4:deploy (default) < package @ couchbase-javaee <<< [INFO] [INFO] --- wildfly-maven-plugin:1.1.0.Alpha4:deploy (default) @ couchbase-javaee --- Dec 21, 2015 1:43:34 PM org.xnio.Xnio INFO: XNIO version 3.3.1.Final Dec 21, 2015 1:43:34 PM org.xnio.nio.NioXnio INFO: XNIO NIO Implementation Version 3.3.1.Final Dec 21, 2015 1:43:34 PM org.jboss.remoting3.EndpointImpl INFO: JBoss Remoting version 4.0.9.Final [INFO] Authenticating against security realm: ManagementRealm [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.010 s [INFO] Finished at: 2015-12-21T13:43:48-08:00 [INFO] Final Memory: 17M/217M [INFO] ------------------------------------------------------------------------ |
Acesse o aplicativo
Conforme mencionado anteriormente, o aplicativo fornece a API HTTP CRUD sobre documentos JSON armazenados no Couchbase. Acesse o aplicativo como:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
curl -v https://$(docker-machine ip couchbase):8080/couchbase-javaee/resources/airline * Hostname was NOT found in DNS cache * Trying 192.168.99.102... * Connected to 192.168.99.102 (192.168.99.102) port 8080 (#0) > GET /couchbase-javaee/resources/airline HTTP/1.1 > User-Agent: curl/7.37.1 > Host: 192.168.99.102:8080 > Accept: */* > < HTTP/1.1 200 OK < Connection: keep-alive < X-Powered-By: Undertow/1 * Server JBoss-EAP/7 is not blacklisted < Server: JBoss-EAP/7 < Content-Type: application/octet-stream < Content-Length: 1402 < Date: Mon, 21 Dec 2015 21:45:40 GMT < * Connection #0 to host 192.168.99.102 left intact [{"travel-sample":{"country":"United States","iata":"Q5","callsign":"MILE-AIR","name":"40-Mile Air","icao":"MLA","id":10,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"TQ","callsign":"TXW","name":"Texas Wings","icao":"TXW","id":10123,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"A1","callsign":"atifly","name":"Atifly","icao":"A1F","id":10226,"type":"airline"}}, {"travel-sample":{"country":"United Kingdom","iata":null,"callsign":null,"name":"Jc royal.britannica","icao":"JRB","id":10642,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"ZQ","callsign":"LOCAIR","name":"Locair","icao":"LOC","id":10748,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"K5","callsign":"SASQUATCH","name":"SeaPort Airlines","icao":"SQH","id":10765,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"KO","callsign":"ACE AIR","name":"Alaska Central Express","icao":"AER","id":109,"type":"airline"}}, {"travel-sample":{"country":"United Kingdom","iata":"5W","callsign":"FLYSTAR","name":"Astraeus","icao":"AEU","id":112,"type":"airline"}}, {"travel-sample":{"country":"France","iata":"UU","callsign":"REUNION","name":"Air Austral","icao":"REU","id":1191,"type":"airline"}}, {"travel-sample":{"country":"France","iata":"A5","callsign":"AIRLINAIR","name":"Airlinair","icao":"RLA","id":1203,"type":"airline"}}] |
As operações CRUD (GET, POST, PUT, DELETE) podem ser executadas no recurso Airline no aplicativo. A API CRUD completa está documentada em github.com/arun-gupta/couchbase-javaee. Este blog explicou como acessar um banco de dados NoSQL a partir do JBoss EAP 7. Leia mais sobre o Couchbase 4:
- O que há de novo no Couchbase Server 4.1
- Documentação do Couchbase Server
- Entre em contato conosco pelo Fóruns do Couchbase
- Seguir @couchbasedev ou @couchbase
Saiba mais sobre o Couchbase neste recente webinar voltado para desenvolvedores: