25
ROME 11-12 april 2014 ROME 11-12 april 2014 Talk title: WildFly 8 Introduction [email protected] Francesco Marchioni

Introduction to Wildfly 8 - Marchioni

Embed Size (px)

DESCRIPTION

Le slide di Francesco Marchioni presentate a Codemotion Roma 2014

Citation preview

Page 1: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014ROME 11-12 april 2014

Talk title: WildFly 8 Introduction

[email protected]

Francesco Marchioni

Page 2: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014 - Francesco Marchioni

Francesco Marchioni

Owner of mastertheboss.com

Book author @ PacktPublishing @ ItBuzzpress

Page 3: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014 - Francesco Marchioni

A bit of history

JBos

s

4.0.

0JB

oss

4.2.

3

JBos

s A

S

5.0.

0

JBos

s A

S

5.1.

0JB

oss

AS

6.0.

0

JBos

s A

S

7.0.

0

JBos

s A

S

7.1.

1

Wild

Fly

8

J2EE 1.4 Certification

JEE 1.5 Certification

JEE 1.6 Certification

JEE 1.7 Certification

Page 4: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Why «WildFly» ??

Reduce overlapping caused by the «JBoss» brand

Differentiate the licensed version from the Community version

Page 5: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

WildFly new features

Java EE 7 support New Web server architecture (Undertow) System Administrator friendly (only 1 port used

for management) Role Base Access Control and auditing Patch management Simplified clustering

Page 6: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Java EE 7 Highlights

JSR-352 Batch API for Java platform JSR-236 Concurrency API for Java EE

applications JSR-353 Java API for JSON Processing (JSON-P) JSR-356 Web Sockets API JSR-342 JMS 2.0 API JSR-330 JAX-RS 2.0

Page 7: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

WildFly Java EE 7 API

CDI Extensions

JSF 2.2JSP 2.3EL 3.0

JAX-WS 2.2JAX-RS 2.0 JSON 1.0 WebSocket

1.0

Servlet 3.1

CDI 1.1Interceptors 1.2

JTA 1.2Common

Annotations 1.1 Concurrency 1.0

Managed Beans 1.0 EJB 3.2

JPA 2.1 JMS 2.0 JCA 1.7 Batch 1.0

Page 8: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Batch API

<job id="MyJob">

<step id="BatchProcessor" next="cleanup"> <chunk checkpoint-policy="item" item-count="10"> <reader ref="MyItemReader"></reader> <processor ref="MyItemProcessor"></processor> <writer ref="MyItemWriter"></writer> </chunk> </step>

<step id="cleanup"> <batchlet ref="CleanUp"></batchlet> </step></job>

Chunk Step

Batchlet

Page 9: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Web sockets API

@ServerEndpoint("/echo")public class ExampleWebSocket {

@OnMessage public String onMessage(String message) { return “Hello “+message; } }

Page 10: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Web Sockets JS Client<script type="text/javascript">function WebSocketTest(){ // Let us open a web socket var ws = new WebSocket("ws://localhost:8080/WebApp/echo"); ws.onopen = function() { // Web Socket is connected, send data using send() ws.send("Message to send"); alert("Message is sent..."); }; ws.onmessage = function (evt) { var received_msg = evt.data; alert("Message is received..."); }; ws.onclose = function() { // websocket is closed. alert("Connection is closed..."); }; } }</script>

Page 11: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Concurrency API

@Resource(name = "DefaultManagedExecutorService")ManagedExecutorService executor;

executor.execute(new MySimpleTask1());

public class MySimpleTask1 implements Runnable {

public void run() {System.out.println("Thread

started.");}

}

Page 12: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

JMS 2.0 API

@Statelesspublic class MessageSender {

@Inject JMSContext context;

@Resource(mappedName=“java:jboss/jms/queue/exampleQueue”)private Queue queue;

public void sendMessage(String message) { context.createProducer().send(queue, message); }}

14:28

Page 13: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Undertow Web server

• Lightweight Web Server : core JAR size < 1 MB - Runtime < 4 MB

• Supports HTTP Upgrade to allow multiple protocols multiplexing over HTTP

• Supports Servlet 3.1

• Runnable as Embeddable or Standalone

• Modular architecture built on Handlers which can be chained

Page 14: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Undertow Web server

public class HelloWorldServer {

public static void main(final String[] args) { Undertow server = Undertow.builder() .addHttpListener(8080, "localhost") .setHandler(new HttpHandler() { @Override

public void handleRequest(final HttpServerExchange exchange) throws Exception { exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain"); exchange.getResponseSender().send("Hello World"); } }).build(); server.start(); } }

Page 15: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Server Port Reduction

Port 9990 AdministrationPort 8080 HTTP + HTTP upgrade

Port 9999 Native managementPort 4447 Remoting

Removed

Page 16: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Patching

Patching allows updating libraries and configuration files

Patches distributed as a zip file containing libraries and metadata

Installed using the Command Line Interface

Patches can be rolled back and invalidated by other patches

Page 17: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Patching

[standalone@localhost:9990 /] patch apply /path/to-patch/patch.zip

[standalone@localhost:9990 /] shutdown --restart=true

Page 18: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Role Base Access Control

In JBoss AS 7 every user is a SuperUser

Lack of granularity

Page 19: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Role Base Access Control

Administrative Users can be mapped to RolesRoles = set of Permissions

Permissions: Actions (access, read/write config and runtime)

Set of Constraints: Sensitive resource Sensitive data Application Resource Auditing

Page 20: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Role Base Access Control

Roles:

Monitor: read non-sensitive resources Operator: Monitor + start/stop servers and resources Deployer: Operator + Deploy application and resources Maintainer: Deployer + Configure applications and resources Administrator: Mantainer + System Configuration Auditor: Mantainer + Audit logging SuperUser: Everything

Page 21: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Role Base Access Control

Scoped Roles:

A role that is Server Group scoped restricts the permissions of that role to one or more Domain Server Groups.

Page 22: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Role Base Access Control

Host Scoped Roles:

A role that is bound to one Domain Host Restricts the permissions of that role only to that Host.

Page 23: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014

Clustering Enhancements

New Stateful SB Clustering implementation

@Clustered annotation deprecated

EJB

Cache<K, V> cache;

EJB.jar

Cache<K, V> cache;

JBoss AS 7 WildFly 8

Page 24: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014 - Francesco Marchioni

WildFly books

http://www.itbuzzpress.com

Page 25: Introduction to Wildfly 8 -  Marchioni

ROME 11-12 april 2014 - Speaker’s name

Questions ??