Mostrando postagens com marcador Camel. Mostrar todas as postagens
Mostrando postagens com marcador Camel. Mostrar todas as postagens

24 janeiro 2014

Hackathon de Java e Raspberry Pi na CPBr14


Você que é desenvolvedor Java e vai para a Campus Party na semana que vem de 27 de Janeiro a 2 de Fevereiro de 2014, não pode perder o Hackathon de Java e RaspberryPi promovido pelo SOUJava, com apoio da Oracle, trazendo kits, premiação, e mentoring! O objetivo é aprender, praticar e inovar, e todos os participantes ainda vão ganhar uma camiseta. Um dos projetos será selecionado para apresentação no palco principal!

Presença de grandes nomes da comunidade Java brasileira como:

Para maiores informações, consulte o site do SOUJava Hackathon de Java e Raspberry Pi na Campus Party.

11 novembro 2013

Reality of Open Source Users in Mobile and Cloud Era

- "I built my Android app entirely with Open Source products, both in the app, and in the backend server running on Amazon. I'm charging US$ 1,99 for it in the Google Play Store" 
- "That's wonderful! Where is the source code of your app? Have you contributed back to these Open Source products? Will you release your product as Open Source?"

In this new era of Cloud Computing and Mobile apps, there's an increasing number of for-profit products that takes advantage of Open Source products, but barely contribute anything back to them, either by buying support, or non-expensive things such as reporting bugs, fixes, or helping documentation. Developers are building SaaS applications for Salesforce.com, or Mobile apps for Android and iOS devices, and usually charge for these. Of course, they want to make money as anyone else.

Whenever I ask someone that makes money with _their_ software built on top of Open Source, if they will ever release the source code, they usually answer: "my case is different". Well, why is your case different? Why can't I buy your app from Google Play Store, and still access the code on GitHub? Or build it on my own, customize it, etc? That's the point of Open Source, right? Wrong, in their minds.

Majority of software developers actually tend to think that Open Source is free as in free beer. And that's it. No matter how hard you try to explain otherwise, the industry will almost always see Open Source software as free software. And due to the new way to sell software, I really think that Mobile apps and Cloud SaaS/PaaS offers will, sooner or later, kill good Open Source softwares, and leave this space only for conceptual and initial implementations for Open Standards and APIs, or for general use and development platforms and languages such as Java, Ruby, etc.

Perhaps you want to read Will Cloud kill Open Source? Is the Future Open Standards? Your thoughts are welcome :-)

10 setembro 2013

Java SE 7 update 40 e o Mission Control 5.2

Java SE Downloads
Chegou uma nova atualização do Java SE 7: update 40. Esta versão inclui várias novas funcionalidades como o Java Mission Control, Deployment Rule Set, suporta para o Retina display no Mac, e suporte a Hard Float ABI no Linux ARM v7. Também inclui diversas correções de bugs. Para quem desenvolve Applets e aplicações Java Web Start, este release, fica a atenção para conhecer e enteder as mudanças.

Deployment Rule Sets

Esta funcionalidade permite um administrador de desktops a controlar o nivel de compatibilidade para clientes Java assim como níveis de segurança para a empresa. Para maiores detalhes, veja a documentação do Deployment Rule Set.

Java Mission Control

O Mission Control era até então uma ferramenta disponível para clientes Oracle, e que foi lançada há muito tempo atrás junto com o JRockit (JRMC). Mas a Oracle agora disponibilizou a ferramenta junto com a JRE HotSpot 7u40. 

Esta ferramenta permite monitorar, gerenciar, introspectar, e detectar memory leaks nas suas aplicações Java, sem ter que introduzir códigos para isso, que normalmente degradam a performance da aplicação. Hoje esta ferramenta está agora disponível no download do Oracle HotSpot JDK 7u40!

Flight Recorder

Mas a principal e mais importante característica é o Flight Recorder. Este recurso funciona através da leitura de eventos produzidos pela JVM. Mesmo ativando a geração destes eventos, a sobrecarga total  para as suas aplicações ainda fica abaixo de 2%, que considerando o tipo e o valor de informação que você recebe, é quase nada. Um exemplo de evento é a chamada de um método de uma classe Java.

Com o profile de chamadas de métodos você pode descobrir onde o aplicativo está gastando a maior parte do tempo executando seu código Java. Este é, por exemplo, útil para otimizar a aplicação onde as otimizações realmente terão impacto. Isto sem precisar introspectar seu código manualmente!

Alem disso, você tem também uma visão de otimização para alocação de objetos. Você pode ver por exemplo, a alocação em tempo real de objetos na Old Gen da memória heap. diretamente no espaço de idade, além de outras abas que oferecem diversas informações importantes sobre o processamento de informações na sua aplicação Java. Leituras de arquivos I/O, Socket I/O e muito mais.

Se você precisa de mais informações sobre o Mission Control, entre na página da ferramenta em www.oracle.com/missioncontrol.

E obrigado ao Markus Eisele por ter cedido parte deste post! :-)

22 fevereiro 2013

Encontro SouJava na Oracle (JMS e Cache Distribuido)

No dia 21 de Fevereiro estreamos o novo escritório da Oracle abrindo as portas para o grupo de usuários do SouJava. Com a presença do Bruno Souza, Ricardo Ferreira, Edgar Silva, Vinicius Senger, Mauricio Leal e muitos outros, tivemos a participação ao todo de 26 pessoas.

Durante a reunião, apresentei As Novidades do JMS 2.0, parte importante do Java EE 7 e que teve votação do Public Review no dia 19/02. O SouJava votou a favor, não só pela qualidade mas também pela transparência da especificação.

A outra apresentação foi do Ricardo Ferreira, falando sobre Processamento de Dados em Memória usando Elastic Data Grid (In-Memory Computing), que demonstrou a importância do uso de cache distribuído em arquiteturas altamente escaláveis, com o Oracle Coherence.

No final, os participantes conheceram o novo escritório da Oracle e ainda foram muito bem recebidos com muita pizza. Confira as fotos do evento!

04 janeiro 2013

Issue dev'ing RESTful JSON services on NetBeans


Here is a tricky issue that you may find if you are developing RESTful services with Java EE on NetBeans and GlassFish or WebLogic. If you want to support the JSON format but need to access some implementation classes like @JsonIgnore, you need to add the JAX-RS RI, Jersey, to your project's Libraries definition. How to add the RI? You will probably do this:
  1. Open project's Properties (right click on the project)
  2. Go to Libraries
  3. Click on 'Add Library'
  4. Select 'Jersey 1.8 (JAX-RS RI)
But you won't have your service running fine. You may find these exceptions: (added here so Google can help future users)
1 - If you try to access your RESTful service to get a JSON format of it, you will get this exception:
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
  at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
  at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
2 - If you try to access your RESTful service to get an XML format, you will get this exception:
java.lang.RuntimeException: javax.naming.NameNotFoundException: Unable to resolve 'com.sun.jersey.config.CDIExtension'. Resolved 'com.sun.jersey.config'; remaining name 'CDIExtension'
  at com.sun.jersey.server.impl.cdi.CDIExtension.getInitializedExtension(CDIExtension.java:177)
  at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory.(CDIComponentProviderFactory.java:92)
  at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize(CDIComponentProviderFactoryInitializer.java:75)
  at com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:576)
  at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.configure(ServletContainer.java:311)
 If you look at your server's log, (in my case, I was using WebLogic 12c) you may find this message somewhere:
WARNING:
**********
The application is using ServletContainerInitializer class com.sun.jersey.server.impl.container.servlet.JerseyServletContainerInitializer that is loaded from:file:/labs/wls1211/modules/com.sun.jersey.server_1.1.0.0_1-9.jar. This initializer overrides the one available in the system.
**********
When you added Jersey to your library, the "package" checkbox was checked by default. So the JAR ended up going into WEB-INF/lib of your project, conflicting to the already provided by the container. 
So, how to fix this issue? Follow these steps:
  1. Open project's Properties (right click on the project)
  2. Go to Libraries
  3. Uncheck the checkbox 'Package' for Jersey 1.8 (JAX-RS RI)
  4. Click on 'OK'
  5.  Clean & Build (right click on the project) ---> remember to clean and rebuild your project
  6. (re)Deploy application
Done! :_)
https://blogs.oracle.com/brunoborges/entry/issue_dev_ing_restful_json

14 setembro 2012

Customizing Camel components within Scala DSL

Even though I joined Oracle last July, I continue to have fun with some of other technologies, like the Scala language. And as I used to evangelize the Apache Camel framework in Brazil, I think I still owe some things to the Open Source community.

In a few weeks, I will be at JavaOne to talk about Apache Camel and the Camel Twitter component that I contributed, together with Brett Meyer, months ago. So while developing the demo, I found a small issue with the Camel Scala DSL that couldn't find anywhere else.

How to customize components within the Scala DSL for Apache Camel?
It happens that, using Java DSL, you can customize components simply like this:

But using Scala DSL, does that really work?

Not really... If you try this, the Camel Twitter component will throw an error saying that no token was provided for authentication. So here is how you make it work:

Hope this helps you some day! And you are welcome to attend my session "Leverage Enterprise Integration Patterns with Apache Camel and Twitter", at JavaOne 2012!

19 junho 2012

Issue with JBoss and Camel

If you are like me and are trying to run Apache Camel on JBoss 7.1.1, you may face an issue related to this exception:
Error description: You receive a stacktrace with an inner exception
on the form below.
Caused by: java.lang.NullPointerException
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.checkOverrideProperties(ClassBeanInfoImpl.java:205)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:186)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.<init>(ArrayReferenceNodeProperty.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ ... and a looong intermediary stack trace removed ... The stacktrace
ends with: ]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:277)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext
This happens because there's a bug on JAXB 2.2.4, the version used by default on JBoss 7.1.1.
I honestly don't know if this also happens to any other JBoss 7 versions, but this is a bug only with JAXB 2.2.4, so if the version you have has this JAXB version, you also have this problem.

To fix this, follow these instructions:

  1. Download the new version of JAXB (from Maven Repo)
    1. jaxb-impl-2.2.5-2
    2. jaxb-xjc-2.2.5-2
  2. Put these files on this JBoss folder:
    1. jboss-as-7.1.1.Final/modules/com/sun/xml/bind/main
  3. Open the file module.xml
    1. replace the old version (2.2.4) with the new one (2.2.5-2)
  4. Done!
Now get back to work!

PS: part of this solution (updating JAXB) is thanks to this thread.

09 novembro 2010

ApacheCon Brazil and why we need it?


I'm not sure if this mailing list is the right one to write about this, but I'm gonna take the risk. I suppose "Community" means anything related to it. And this is definitely about community.

Before anything, I'd like to share my history with ASF. (skip if you want... :D)

When I started to get involved with the Apache Software Foundation in a deeper level, I was still just a user, downloading Tomcat and using it. I guess most Java developers for the Web environment still do that.

5 years a go, I joined the Apache Wicket community and then my relationship with ASF has born. And for the last 5 years I've been speaking about it in Brazil, either in JUG meetings or at conferences around the country and sharing everything I wanted to share on my blog. I've even created a Google Groups for that, called Wicket pt_BR. With my contributions as an "evangelist" I gave birth to friendships with great people like Martijn Dashorst, Jeremy Thomerson, Eelco Hillenius and others from the Wicket community.

Then, in 2008 I heard about the Apache TAC and, thanks to ASF, I could meet them in person during ApacheCon @ New Orleans. It was better than anything I've ever experienced. Considering how close I was to great people, professionals and friends, and how easy I could start chatting about anything to them, I thought that was the best conference it could ever exist. I thought: "ApacheCon is the best. I got free beer!". That was cool. Every conference I go here in Brazil, I wish someone put some beers instead of Coke. Until now... only #fail

Then, right after I came back from New Orleans, I started to play with the SOA stack (CamelCXFServiceMix and ActiveMQ). I also became friend of great people like Bruce Snyder, Claus Ibsen, Hadrian Zbarcea and Debbie Moynihan.

Last year, 2009, when I heard about ApacheCon in San Francisco, I took the chance to apply again to the Apache TAC (no, I wasn't bargaining; it really is expensive to fly from Brazil to the USA, specially SF). I just applied for the tickets, and for accommodation I was safe with CouchSurfing friends I already knew. Also, I really wanted to help the organization. It was when I met Nick Burch, Ross Gardler and Noirin Shirley. Could not forget my latin friends Amelia Blevins and Carlos Sanchez. Other names like Jesse McConnell, David Blevins and Yeliz Eseryel are also in my good memories of ApacheCon 2009. Unfortunately this year, because of personal reasons (not because of TAC rules), I couldn't be present at ApacheCon.

With the help of Bruno Souza, I discussed with some people, including Sally Khudairi, the idea of bringing ApacheCon to South America.

What I saw on ApacheCon '08 and '09 was something amazing. Perfect for South America. Perfect for Brazil. The Apache Way is something that must be shared with everyone. 

A few months a go, I went to Brasilia (country's capital) to talk about the ASF in general, not on an specific project. It's amazing how people are unaware of what the ASF really is. And how people limit their knowledge to only what the big players show to them. Still, they all know Struts and Tomcat. It seems that South America is a big user of Apache projects rather than truly contributors.

Now this year, with JavaOne going to happen in Brazil, and the sessions that were scheduled, I believe it is now the time to drive ApacheCon south. There's no single talk about anything related to the Apache Software Foundation in this South American version of JavaOne. And I feel really sad about that. Sad that people that are behind the organization had the opportunity to accept papers (I myself proposed Wicket and Camel - papers I have been presenting since 2008 for rooms of 30~40 attenders).

And I'm sure everyone will use Maven, Ant or Tomcat to demonstrate something.

I don't know if this happened because of recent issues between Oracle and Apache, or just because of Java standards (like JSF, JavaFX, EJB) are more important than non-standard projects. It doesn't matter. I'm sure there was room. On my count, there are at least 3 subjects with more than 1 submission approved. Look at JavaOne track.

Now, if the ASF, the most voted JCP EC member (with 95% votes), has no space on JavaOne Brazil, the country who have been participating in the Open Source movement, giving birth to the OpenJDK thanks to Javali project, and Bruno Souza, than we should start considering other alternatives. Alternatives to standards, like Wicket or Camel.

We already have ApacheCon Europe and North America. I'm sure we can do ApacheCon South America.

Let's do this happen. Let's do it the Apache way.

Bruno Borges

21 setembro 2009

Camelo no GitHub também


Seguindo a sugestão do Marcos Pereira, coloquei o código do camel-twitter e principalmente, os demos que utilizei na minha palestra, lá no GitHub.

Valeu Marcos!

06 abril 2009

Leverage EIP with Apache Camel and Twitter: Part 3


Alright, so I've just submitted a JIRA issue to the Apache Camel project, donating the source code of this component. Anybody interested just follow this link and download the component itself or wait to see if they commit it into the SCM.

The component can publish, like I've showed you on my last post, and also consume some user's twitter page / the friend's timeline of someone or the public timeline. It's really cool.

If you wanna try it by yourself, just download the attachment, set up the maven project as a module of Apache Camel (yes, you will have to download the whole Apache Camel sourcecode tree) and then build it. Or... edit the pom.xml to fix some parent references. I hope you know something about Apache Maven too.

On my next post, I promise to show you how to use it and all the possible parameters. Or take a look at the source code and play with it.

Have fun. :-)

30 março 2009

Leverage EIP with Apache Camel and Twitter: Part 2

On my first post I introduced you about a problem a customer brought to me to solve. And I thought using Apache Camel to advertise on Twitter could actually fit into his business needs (and mine as well). The first thing I had to think about was on how to receive ads from different customers in different formats. This way I could let them continue to use any format they are already using to publish ads online.


Fig 1. receiving advertisements

To receive messages in different formats is easy. Just open endpoints where they can connect to and publish their files/messages/whatever. Camel comes with a lot of different components to implement these “incoming” endpoints. I had to put some Pipes and Filters before the Message Normalizer to load data into Message Exchange headers, and to drop invalid messages.

After a valid message arrives into CamelContext, they need to be normalized to a common format. Using the pattern Message Normalizer (a Content-based routing connected to different message translators), I convert all messages into TweetAd Java objects. This class looks like this:
public class TweetAd {
private TwitterAccount account;
private String advertisement;
// getters and setters
}

To translate messages, I did something like this kind of route:
    from("file:ads-inbox")
.to("bean:loadTwitterAccountHeaders")
.to("bean:transformIntoTweetAd")
.to("direct:tweets");

Cool, now I have a normalized Twitter Advertise a. What's next? Just forward it to a Message Endpoint that publishes TweetAd objects.

I didn't want my Twitter Publisher to require all incoming messages to be a TweetAd object type. So I've coded it in a way that could also publish whatever String context that message could supply. If the Message Exchange's body wasn't a TweetAd, with a valid TwitterAccount object associated to it, this endpoint would require username and password.
This is how my route looks like after having a valid TweetAd object:
    from("direct:tweets").to("twitter:publisher");

And I could have routes like this, for non-TweetAd objects:
    from("bean:amazonAWSAds")
.transform(body().convertToString())
.to("twitter:amazon?user=amazon&pass=nozama");

Done. Now I can publish ads coming from different customers, in different formats, to different Twitter accounts massively. Problem 1 solved. On my next post I will show you the code of Twitter Publisher.

See ya!

26 março 2009

Leverage EIP with Apache Camel and Twitter

I had no clue Enterprise Integration Patterns could actually work together with Twitter, for a business need. The thing is that, everybody is looking for ways to integrate everything within everything. And that's what this article tries to explain.

The idea to integrate Apache Camel and Twitter came when a customer was looking for a way to advertise on Twitter into different accounts, each one for different segments as no one actually wants to follow 100+ departments in the same account. That said, the enterprise will have 100+ Twitter accounts and its customers will now be able to follow only the departments they actually want to.

To create a lot of different accounts, there's nothing we could do about it. But to tweet a lot, well, that was piece of cake. Now, the advertisement system can be easily integrated with Web Services, file upload, Web requests, etc. A server that can tweet for different enterprises, sending messages in any format, to advertise.

Another interesting thing to do is to follow customers from these enterprises. If they put on their accounts their Twitter screen names, we can easily follow them and massively process everything they are talking about. Then see what's going on about new tendencies, products and services.

Apache Camel is a great EIP framework that can be embedded into different applications, from Web to Desktop. Twitter4J is a great API developed by Yusuke Yamamoto. With these two libraries all I mentioned previously can be easily achieved.

To give an idea, here is an example:


public class TwitterRoute extends RouteBuilder {
public void configure() throws Exception {
// Message Channel - polling ads from files
from("file:ads-inbox")
// MessageTranslator
.transform(body().convertToString())
// Tweet it!
.to("twitter:tweetit?user=cameltweet&pass=***");

// get all friends timeline from user 'brunoborges' and wire tap them
from("twitter:tweets?user=cameltweet&pass=***&type=FRIENDS&follow=brunoborges")
.transform(body().convertToString())
.to("bean:wiretap");
}
}


On my next post I've put more details about the architecture involving Camel and Twitter.

** UPDTE 03/30/09 **
If you are interested in this component and architecture, please read the Part 2.

See ya!
Contato

Email:bruno.borges(at)gmail.com

LinkedIn: www.linkedin.com/in/brunocborges
Twitter: www.twitter.com/brunoborges
Comprei e Não Vou
Rio de Janeiro, RJ Brasil
Oracle
São Paulo, SP Brasil