Friday, September 23, 2011

JBossInBossa 2011 : Brazil


Next October 8th, we will be hosting the largest Brazilian JBoss User Group Conference in brazilian federal capital : Brasilia.

In 2010 we made a great conference in São Paulo, but this year we decide bring to Brasilia, once it is closer to Northeast and North region in Brazil, besides this city is one of the most important cities for opensource movement , there you can find a lot of government agencies in the public sector in Brazil, where they are consuming many opensource technologies.

We are proud to offer a high-level of speakers and sessions , covering many JBoss Technologies, in the speakers list the audience will be able to find some of JBoss Community stars, such as:

  • Flavia Rainone (Core Developer on AS7)
  • Mauricio Salatino (Committer in Drools/JBPM5)
  • Alexandre Porcelli (Contributions in Hibernate and Drools)
This year we made a Call 4 Papers with a very great level of speakers and sessions, so people will meet a lot of new speakers.

We also will have some Red Hat employees, from several departments, such as: Support, Consulting and Solutions Architects.

We used Google Translator in order to allow you check our agenda , and the best stuff about that event, the whole content we are charging just equivalent to US$25 , cheap hun?

Special thanks for James Cobb and Cheyenne Weaver for helping with our JBUG branding. 


Tuesday, January 18, 2011

Enabling RestEasy as JAX-RS Impl in Scalate

Scala as a language and its community is gaining a lot of attention, in fact, there are certain use cases where Scala offers incredible advantages over the traditional Java Language "as it is".

Although my experience with Scala so far is completely away from Web technologies, I've seen a lot of discussion about this matter, and a good solution for web applications can be basically a very simple composition:

  • HTML5 + REST Services [JSON]
  • HTML 5 + JavaScripts Toolkits such as JQuery and other + REST Service + [Many media types]

For the scenario that I mentioned above, I found out the framework Scalate, a good option for who is looking for a good getting started with Scala and Web.

 If you go in the Scalate's Getting Started Tutorial, everything works fine.  I spent the last couple of weeks researching a lot about which IDE to use, and at this moment honestly I recommend you use InteliJ Idea Community Edition with Scala plugins, it works incredibly fine and pleasant.

Well, but this post's title is about to enable RestEasy in Scalate Projects, so here will go deeper in this subject: Scalate by default comes with Jersey support implementation, which is another JAX-RS implementation, nevertheless for obvious reasons :) I prefer JBoss RestEasy, and in this post you will learn how you can change your scalate project to use RestEasy instead Jersey.

Everything I made is on my github online repository, I called this "version" of my scalate+resteasy project: easyscala, and you can checkout all the sources from here: https://github.com/edgars/easyscala

Changing the pom.xml

This is the first task you have to do, so you have to add RestEasy dependency in the pom.xml, although there is an important detail that I noticed when I tried to do that:
  • If you do not ignore the org.slf4j package, you will get an error, that I had not chance to go deeper to check the reason, that's why when I added RestEasy dependency I excluded the reference for this package, maybe some version conflicts of any other stupid thing that I had no time to check.

         org.jboss.resteasy
         resteasy-jaxrs
         ${resteasy-version}

   
   org.slf4j
    *
   

          compile


Changing the web.xml

Another change that I did, was in web.xml, where I removed the Jersey Servlet Filter's and any related configuration, and I added the RestEasy declaration as the following code:

     resteasy.scan     true

      resteasy.servlet.mapping.prefix      /resteasy
 

  Resteasy
  org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
  



  Resteasy
  /resteasy/*
  

With a few changes, I was able to run the first REST Service made with JBoss RestEasy, look that we have a very standard JAX-RS Class in the following example:

package org.jboss.easyscala

import javax.ws.rs.{GET, Path, Produces}
import javax.ws.rs.ext.Provider

@Provider
@Path("/root")
class RootService {

  @GET
  @Path("/hello")
  @Produces(Array("text/xml", "application/json"))
  def getMediaType = "hello"

  @GET
  @Path("/hello")
  @Produces(Array("text/html"))
  def getHTML = "hello"
}

In the class above, we have 2 methods, according to the mime type (media type) that this service is requested, one of them will send the response. Another good point, at this moment, you cannot see any JBoss RestEasy proprietary extension. Obviously according your needs, you may add some helpers.


Conclusion


Scala and their related projects and solutions are gaining a lot of attention, it combines two programming models: OO and Functional, and this combination can make our codes easier, smaller and smarter. I cannot predict that much, but I am working in some specific Use Cases that were totally suitable for Scala, I am not talking about boilerplate code, but about less code with more power, and getting a huge difference when performance is a relevant issue. If you like JBoss tecnologies, like me, this is the first post where I will try show some good and relevant combinations.

Friday, November 5, 2010

Polling any Database table with JBoss ESB 4.9 and Apache Camel - Part 1

Introduction


Poll a database table is very common use case when you are integrating systems and applications, according EIPs(http://www.enterpriseintegrationpatterns.com/): Shared Databse is one of Integration Styles available in the industry.

JBoss ESB 4.9 : Support for Apache Camel 

IMHO, this is the greatest improvement in JBoss ESB from the last 3 years,  we community owe this job to David Ward, which pushed this implementation in that newest Community JBoss ESB release.  David wrote about getting started with Apache Camel and JBoss ESB here: http://community.jboss.org/wiki/CamelGateway. If you need some basic overview about Apache Camel, I recommend you take a look on Camel website:  http://camel.apache.org/.

Where is the benefits of Apache Camel in JBoss ESB?

First of all, we have a plenty of new gateways components available, such component's list is huge, you can see them here. In Apache Camel we have to be aware about the difference between the components, basically there are:
  • Consumers - Which can be message listeners from the URI protocols
  • Producers - Which can post a message into the protocol URI
There are components that commonly can be both, but you might see some components that can be only Consumers or only Producers. It depends of the protocols nature or any other related aspect. 

For that demo, I decided use the JPA Component, as which can be both a producer and consumer.

Demo Use Case

We have many customers asking how they could integrate legacy applications, or even applications written in different platforms, such as .Net or PHP, for this matter we have one thing in common: The Database can be shared between many applications. I am not talking about ETL or even Data Services Federation, at this point I want to just get a row from some table and consider it a "Message", as which I can do anything I want using JBoss ESB Actions.

To turn my demo more realistic I am using the very well known opensource CRM: SugarCRM, which has a table called: Lead, which keeps every leads from the system stored. See Image 1 to see my local SugarCRM instance running:


Image 1 - Sugar CRM with my Leads

The SugarCRM stores the data into any relational database, in my case I am using MySql.

The ESB Project

In my ESB Project, I just have to add an Entity class that will reference the Lead Table, in that case I created the following table:

@Entity
@Table(name="leads")
@NamedQuery(name = "NewLeadsQuery", query = "select x from Lead x where x.status='New'")

public class Lead implements Serializable {
 private static final long serialVersionUID = 1L;

 @Id
 @GeneratedValue(strategy=GenerationType.IDENTITY)
 @Column(unique=true, nullable=false, length=36)
 private String id;

    @Lob()
 @Column(name="account_description")
 private String accountDescription;

   .....

In that Entity you can see that it is a very basic JPA Entity, which contains a named query that will return every Lead that the property status is "New", in other words: Every single Lead will be dispatched to JBoss ESB as a Message, and now you are asking yourself: How ? See the next topic.

Declaring a Camel Gateway in JBoss ESB

What is more important is to know the components that you will interact with, and notice that each component has its dependency, in my case with JPA, I need to add into my project lib folder the camel-jpa-VERSION.jar, which is my component library, I have to do that, because AKAIK just the core camel libraries are in JBoss ESB classpath. Here is my jboss-esb.xml config portion for it:



   
    
   
 


There is a point that I'd like to call your attention: The & symbol as it is declared in XML you have to work with the & representation replacing that symbol

Now, you are able to create any Service in JBoss ESB and several actions to interact with your Message.

In my final release of that demo, I am using JBoss BRMS/Guvnor, that will receive the Lead row as an Object and will decide if it is a Lead that have to be worked by a Sales Rep or an Inside Sales Rep, according some fields on that "Lead fact"


In my upcoming new things in that demo I will have 2 consoles: 1 written using Swing which will listening a JMS Queue for the Inside Sales, which supposedly are inside the company's office, and if it is a lead for an Outside Sales Rep, it will go to an Infinispan Cache, and it will be accessible through an WebSocket HTML 5 Client.

Last Tip about JPA Component

Once you consume a row to the database, maybe you need to change at least the column that makes the row available to be polled, in our case "status=new", So, you can "mark" that row with a new Status, or invoke any other operation, just adding the @Consumed annotation in any method in the JPA Entity.

// Changing 2 column's values in the database, so a polled row, will not be consumed more than one time
@Consumed
 public void checked(){
  
  this.setStatus("EAI-Partner"); 
  this.setStatusDescription("This Lead was Forwarded to a Partner");
  
 }





Next Steps

Partially I have the demo done, I will move that to my Mac, where I can do fancier screencasts, and than you will be able to see it working.


Tuesday, August 10, 2010

RestEasy on GoogleAppEngine: CoreREST

I've been quite busy the last couple of months, with a lot of meetings and customer calls, so far the time to study, to create and researching is becoming rare, activities that I love are becoming less frequent day by day. I have a particular viewing of video games: I hate all them and I hate invitations to play with, I prefer play soccer for real, but in my spare time, between an airport and other, I decided give myself another chance to enjoy Ruby, and to discover why lots of people says so good things about that. So I combined a plenty of subjects that I really enjoy: JAX-RS with RestEasy, JSF2.0 (Sorry, I know a lot of people prefers GWT) and Google AppEngine. The result combination was an open project called: CoreRest (http://corerest.appspot.com)




CoreREST, is a kind of "PaaS"(Platform as a Service), which runs on Google AppEngine, which allows users to create their own lightweight "WebServices" based on REST approach using Groovy, and as sooner as possible with Ruby(powered by JRuby). I also will add many out-of-the-box APIs, such as: Smooks, and XStream, thus will possible: Transform, Convert and create really rich Services.

I used RestEasy 2.0, the JBoss implementation for JAX-RS standard, led by Bill Burke, which runs smoothly on Google AppEngine. I also, decided use another JEE6 standard in GAE: JSF 2.0, which to be honest: Without Seam, JSF seems to be a "Barbacue without salt", but in the end, it is running pretty well.

For persistence, as Google uses BigTable, a noSQL Implementation, the JPA Provider recommended by Google I really didn't liked, so I am using Objectify, which for me was more pleasant and easy to use.

In this first blog entry, I will just let you create and expose a basic "Service" in CoreRest. To do that, see the following instructions:

1- Open http://corerest.appspot.com

2- Click on Groovy logo icon

3 - Fill the following information:

3.1 - Script Name: This is the script name, which will be a kind of "endpoint name", so it will be the key for service invocation, put any simple name for it, your name for instance.

3.2 - URL Mapping - This is the URI that you want for for your service, you will put: /{firstname}/{lastname} .

3.4 - And the Source, will be the groovy script:

String response = lastname.toUpperCase() + ", "+ firstname;
return response;


3.5 - Click on "Save Script"


 


Well, what is happening behind the scenes:

a) the URI is the extension for the "endpoint name", and the location where you will add the variables, exactly as you do according the standard on JAX-RS. In the URL: /{firstname}/{lastname}, we will have 2 variables available for Scripting context, besides the variable "response", which is the variable to return the response as a String, although CoreRest will support some Media types, I am still working on it, once it is totally possible using RestEasy.

To test you script, you just may call you service according the following URL:

http://corerest.appspot.com/service - (Service is the ROOT for endpoints)

http://corerest.appspot.com/service/tutorial/Edgar/Silva

Next Steps:
I will try work on it, improve the UI and the user experience. I would like to say thanks to eXo Platform, for the Groovy Syntax hightlight, and Alexandre Porcelli that helped me to not use Java Regular Expressions and make my code easier :), and Eder Magalhães that tested CoreRest with me last night.

I sooner I get this code not so dirty though, I will publish and let it opensource somewhere, maybe GitHub, once I could at least to do my first commit there without any error :).

Saturday, May 15, 2010

JBoss Technologies presented at 1st nosqlbr

 This saturday, May 15th, we had the 1st Conference about noSQL technologies in São Paulo, Brazil, promoted by Caravela Technologies, in fact, organized by Alexandre Porcelli (former Drools and Hibernate Commiter) - The ANTLR Guy, with his team and his lovely "gang"(his family).

The event started from a simple post on Twitter (#nosqlbr), and from a original planning for 20 people (no regular ones but geeks) going to a bar and between a beer and a cairpirinha, the people would have some discussion about noSQL technologies. However, Porcelli is brazilian, and he never gives up, and in the end the 1st nosqlbr had about 250 attendees in a fancy hotel with an incredible cofee break , good people to talk and so on.

Thursday, April 8, 2010

JBossInBossa 2010 - JBUG:Brasil Conference / May 7th, 8th


We are very happy to announce the JBossInBossa 2010 , the Brazilian JBoss Conference organized by JBUG:Brasil and sponsored by Red Hat and others, which is scheduled for May 7th and 8th.

The audience will be able to meet the following international speakers:
  • Pete Muir , Seam/Weld Project Lead
  • Benjamin Mestrallet, eXo Platform CEO
  • Mauricio Salatino, PlugTree CTO/ Drools Committer 
But the conferece will be in Brazil, so we will count with some JBoss employees providing Workshops and/or Sessions as well, see the following list :
  • Alessandro Lazarotti,
  • Bruno Rossetto Machado,
  • Edgar Silva
  • Flavia Rainone
  • João Paulo Viragine
  • Leandro Abite,
  • Rafael Benevides,
  • Ricardo Ferreira
  • Rodrigo Freire
  • Samuel Tauil
  • Others
We would like also to say thanks to another brazilian companies that are providing really great and worth speakers for our Workshops:
  • Caravela Tech: Alexandre Porcelli (CTO) -Drools Workshop with Mauricio Salatino (Salaboy)
  • Voice Technology - Antonio Anderson Souza (Voice Technology), André Pantalião - Workshop: Social Networking by Phone - Utilizando SeamTelcoFramework
  • Caelum - Paulo Silveira - Workshop: JPA 2.0 na prática, com Hibernate
  • GlobalCode - Alberto Lemos aka Dr.Spock , Vinicius Senger , Yara Senger- Workshop: JSF 2.0 with JBoss 6.x

 We would like to say thanks to James Cobb and his team at JBoss.ORG, they are the people behind the arts, logo and every good visual impact that we are promoting in JBossInBossa Website (http://www.jbossinbossa.com.br).

This is a way to share knowledge, energy and everything good, it is our way to say thanks to the large JBoss Community in Brazil, as well as to celebrate our 3rd birthday of official JBoss presence in Brazil.

This is our agenda for May 8th:

9:00 - 10:00

Seam 3, Weld, CDI , JEE 6 - Pete Muir

10:00 - 10:20

Cofee-Break

10:20 - 11:20

JBoss Application Server 6 Revolutions! - Flavia Rainone

11:20 - 12:20

SOA Showcases - Teiid(MetaMatrix) e BRMS - Ricardo Ferreira


13:20 - 14:20

Plataforma de Portais GateIn - Benjamin Mestrallet

15:30-16:15

Gerenciamento Efetivo de Ambientes JBoss com JOPR/JON - Rodrigo Freire e João Paulo Viragine

15:05-15:30

Cofeebreak - Intervalo

15:30-16:15

Apresentando o Projeto XSeam e Arquiteturas de Referencia em Seam  Alessandro Lazarotti e Rafael Benevides

16:15-17:00

Breakingwoods & JBoss para plataformas de Integração de Sistemas - Edgar Silva

17:00-17:50

Drools Fusion e DroolsFlow - Mauricio Salatino

17:50-18:50

RichFaces 4 e JSF 2.0 - Pete Muir


In the next year, we are already planning a bigger event, who knows in another location, I hope some place like Rio de Janeiro or Fortaleza :)

Cheers

Edgar


    Friday, April 2, 2010

    Speaking at Jazoon 2010


    I am very happy to be accepted to be speaking at Jazoon 2010 with my paper entitled: "Opensource SOA on Steroids: Combining the robustness of JBoss ESB with the flexibility of Apache Camel".  I am very excited with that, and already planning a cool presentation with a lot of energy and ready to share many good topics with the audience.

    Other much more relevant and famous JBossians were also accepted, see the following list :
    • Dan Allen
    • Emmanuel Bernard 
    • Heiko Braun 
    • Jean Deruelle 
    • Wesley Hales 
    • Aslak Knutsen 
    • Anil Saldhana
    See the full list here: http://jazoon.com/Conference/Speakers 

     I am proud to be representing the JBoss Solution Architects Team from Red Hat, and happy to have the chance to meet those incredible technicians there,  as well as all Java community that will be present there.      

    I will try bring with me a "Cachaça bottle"  in order to prepare for my friends some "Brazilian Caipirinhas (http://en.wikipedia.org/wiki/Caipirinha)", which is a really good mixing... Essentially as JBoss ESB and Apache Camel can to be.