Jeff Mesnil
Weblog · About

Photo Walk by Night

July 20, 2012

Last night, I went out with a few friends for a photo walk (and beers!) after sunset.

I put a 35mm f/1.8 on my D7000 and took only a small Manfrotto tripod to help for long exposures. Lights were a challenge all night long and the white balance was hopelessly confused by all the different light sources.

I focused mainly on architectural details (doors, knobs) and the reflection of the city lights in the river. I wanted to catch the river with a silky aspect and contrast it with the harsh lights coming from the buildings.

It was a fun night and I am looking forward to the next one.

Old Door
Old Door
Yellow/White Walls
Yellow/White Walls
City Lights in the River
City Lights in the River
Tribunal
Tribunal
Trekkie Knob
Trekkie Knob1


  1. This shot could have been taken straight from Star Trek movie

Fête de la Musique

June 22, 2012

Fête de la Musique
Fête de la Musique

The weather was not great for la fête de la Musique this year but it is always fun to wander in the streets listening to both amateur and professional musicians.

JBoss EAP 6.0 GA is Released

June 21, 2012

JBoss by Red Hat

It's official: JBoss EAP 6.0 GA is released. One of its highlights is the integration of HornetQ as its messaging provider. Using EAP6 means you can now have support from Red Hat for HornetQ.

I came back to Red Hat only a few months ago and did not contribute much to the HornetQ integration into the application server. This was a great collaboration between the AS and HornetQ teams to ensure the best experience to configure and use HornetQ.
I'd even recommend to leverage EAP6 (or JBoss AS 7.1) over standalone HornetQ servers. Wether you only need a messaging server or not, the management and deployment features brought by the AS are invaluable in production environment.

I wrote most of my contributions to EAP6 in HornetQ codebase during my first stint at Red Hat. I still remember the long hours, hard work and team work to release the best and fastest messaging provider. A few months later, we were able to reach this goal and I am happy to be back at Red Hat right on time to see the benefits of this work.

I can't wait to see what is coming next for JBoss and Red Hat.

Using SockJS with Stomp Over Web Sockets

June 5, 2012

Recently RabbitMQ announced that is was exposing STOMP through Web Sockets and showed an example using my stomp-websocket JavaScript library.

They leveraged a hack in the library to replace the Web browser WebSocket implementation by the one provided by the SockJS library which falls back to a variety of browser-specific transport protocols if the browser does not suppor the Web Socket protocol.

Originally introduced to test the stomp-websocket library, it defined a WebSocketStompMock global variable that was replacing the Web browser WebSocket class by a mock. This was not meant to be used on the client side and is a bit dirty for that (as it pollutes the global namespace).

An user reported that this hack was no longer working on recent commits.

I fixed it and introduced a cleaner way to switch the WebSocket implementation to use by setting the Stomp.WebSocketClass variable instead.

With the most recent version, Web browsers can now leverage the SockJS libary with stomp-websocket using the following code:

Stomp.WebSocketClass = SockJS;
// same as usual
var client = Stomp.client(url)
[...]

Web Sockets for everyone!

⇨ How Yahoo Killed Flickr and Lost the Internet

May 16, 2012

This is the story of a wonderful idea. Something that had never been done before, a moment of change that shaped the Internet we know today. This is the story of Flickr. And how Yahoo bought it and murdered it and screwed itself out of relevance along the way.

I had a sweet spot for Flickr when I started to shoot. I had a pro account for a few years but its site has lingered on without any innovation for a long time and I left it.

Flickr could have been YouTube, Facebook or Instagram. Once a thriving Web site with a enthusiastic community, it is now slowly fading into irrelevance. Sad story...

Another Rose

May 15, 2012

Rose
Another Rose

I continue to work my technique to shoot flowers with my Nikon D7000, 70-300mm f/4.5-5.6G and Hoya close up lens. Unsurprisingly, using my trusted Giotto's Vitruvian tripod helps...

The hidden goal of this post is to check that the photo appears correctly in overlay thanks to Lightbox.

STOMP Over WebSockets With Multiple Frames

May 15, 2012

I updated stomp-websocket JavaScript library to fix a critical bug.

When it receives a WebSocket message, I was parsing it to unmarshall a single STOMP frame. However it is valid to send many STOMP frames in a single WebSocket message (ActiveMQ Apollo does this). I updated the code to take this into account (and check for content-length header too).

This should considerably improve the performance when consuming STOMP messages from the Web browsers.

Thanks to rfox90 which proposed a solution to this fix and Jeff Robbins which tested it on many STOMP brokers to validate it.

The latest version of the library is available on GitHub.

⇨ RabbitMQ + STOMP + WebSockets

May 15, 2012

RabbitMQ is now providing messages to Web browsers with STOMP over Web Sockets.

Interestingly, in their examples, they use my stomp-websocket library library with SockJS instead of the native WebSocket object:

WebSocketStompMock = SockJS;

var client = Stomp.client('http://127.0.0.1:55674/stomp');
...

⇨  JBoss Admin for iPhone

May 15, 2012

Chistos Vasilakis announced last week this iPhone app to manage JBoss AS 7 instances.

The code is Open Source and hosted on Github.

It screams for an iPad version... I need to find an extra 25th hour in the day to contribute to it.

Rose

May 9, 2012

Rose
Rose

Taken with a Nikon D7000, 70-300mm f/4.5-5.6G and Hoya close up lens.

I am struggling to get sharp images using Hoya close up lens. Macrophotography does not like approximation.

How To Enable STOMP Messaging Protocol in JBoss AS7

May 3, 2012

Since I have started working on AS7, I have been pleasantly surprised by its ease of configuration. My favorite thing about AS7 (after its fast boot time) is that its configuration is located into a single file.

If you need messaging with AS7, you can use its standalone/configuration/standalone-full.xml configuration file which contains a messaging stack built on top of HornetQ. The whole messaging stack is configured in its messaging <subsystem>:

<subsystem xmlns="urn:jboss:domain:messaging:1.2">
    <hornetq-server>
        ...
    <hornetq-server>
</subsystem>

By default, AS7 only supports JMS as its messaging protocol. If your applications needs to send and receive messages from other platforms or languages than Java, JMS is not an option and you need to enable STOMP too.

Fortunately, adding STOMP support to AS7 is dead easy:

  1. add an HornetQ acceptor to let AS7 accept STOMP frames on a dedicated socket
  2. configure this socket to bind to default STOMP port

To add an HornetQ acceptor for STOMP, edit the standalone/configuration/standalone-full.xml file and add these lines in the <acceptors> section of <hornetq-server>:

<netty-acceptor name="stomp-acceptor" socket-binding="messaging-stomp">
    <param key="protocol" value="stomp"/>
</netty-acceptor>

The stomp-acceptor is expected to receive STOMP frames on the socket binding named messaging-stomp.

At the end of the same standalone/configuration/standalone-full.xml file, add a <socket-binding> to the <socket-binding-group name="standard-sockets"> section:

<socket-binding name="messaging-stomp" port="61613"/>

61613 is the default port for Stomp brokers.

With these 2 changes, we can now start JBoss AS7 with STOMP enabled:

$ ./bin/standalone.sh -c standalone-full.xml
...
14:14:38,027 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-2) Started Netty Acceptor version 3.2.5.Final-a96d88c 127.0.0.1:61613 for STOMP protocol
...
14:14:38,263 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.2.Final-SNAPSHOT "Brontes" started in 2749ms - Started 163 of 251 services (87 services are passive or on-demand)

Before sending and receiving messages from a STOM client, we also need to configure 2 things for the AS7:

  1. add an user (AS7 is secured by default and we must explicitely add an application user to connect to it)
  2. add a JMS queue to send and receive messages on it

To add an user, we use the add-user.sh tool:

$ ./bin/add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Realm (ApplicationRealm) : [type enter]
Username : myuser
Password : mypassword
Re-enter Password : mypassword
What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]: guest
About to add user 'myuser' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'myuser' to file '[...]/standalone/configuration/application-users.properties'
Added user 'myuser' to file '[...]/domain/configuration/application-users.properties'
Added user 'myuser' with roles guest to file '[...]/standalone/configuration/application-roles.properties'
Added user 'myuser' with roles guest to file '[...]/domain/configuration/application-roles.properties'

Finally, to add a JMS queue, we will use JBoss CLI tool:

$ ./bin/jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
[standalone@localhost:9999 /] /subsystem=messaging/hornetq-server=default/jms-queue=test/:add(entries=["/java:jboss:exported/queue/test"])
{"outcome" => "success"}

We now have configured an user and a JMS queue. Let's send and receive STOMP messages using Ruby and its stomp gem (installed with sudo gem install stomp):

require 'rubygems'
require 'stomp'

client = Stomp::Client.new "myuser", "mypassword", "localhost", 61613

client.publish 'jms.queue.test', 'Hello, STOMP on AS7!'

client.subscribe "jms.queue.test" do |msg|
  p "received: #{msg.body}"
end

And it will output the expected message:

received: Hello, STOMP on AS7!

Conclusion

  1. add a <netty-acceptor> with a stomp protocol param
  2. add a <socket-binding> for default 61613 STOMP port
  3. configure users and JMS queues by following AS7 messaging documentation

Using STOMP with AS7 is simple to setup (4 lines to add to its configuration file) and allow any languages and platforms to send and receive messages to your application hosted in AS7.

Node.js + Redis on OpenShift

May 2, 2012

I have a pet project that uses a Web application running on node.js with its data stored in Redis.
Since I joined Red Hat, I took the opportunity to eat our own dog food and port this application from Heroku to OpenShift.

OpenShift does not support (yet) Redis in its list of database cartridges but it is straighforward to build a Redis server from scratch directly in OpenShift by following these instructions.

The next step is to add redis module to the list of dependencies in deplist.txt:

$ cat deplist.txt
...
redis
...

Redis node.js module does not expose a method to create a client from a Unix socket. We need to add our own function to do that and pass the path to the socket located in a temporary directory inside OPENSHIFT_GEAR_DIR directory (I found the code snippet on stackoverflow):

var express   = require('express');
var net       = require('net');
var __redis__ = require('redis');

var createSocketClient = function (path, options) {
  var client = new __redis__.RedisClient(net.createConnection(path), options);
  client.path = path;
  return client;
};

var redis = createSocketClient(process.env.OPENSHIFT_GEAR_DIR + 'tmp/redis.sock');

The rest of the code was not changed at all:

var app  = express.createServer();

// Handler for POST /test
app.post('/test', function(req, res){
  redis.incr('val', function(err, value) {
    if (err) {
      res.writeHead(500);
      res.end();
    } else {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('val=' + value + '\n');
    }
  });
})

...

Once the code is committed and pushed to OpenShift Git repository, the hook will build and start Redis (only the first time) and the Web application is ready to serve any data from Redis:

$ curl -X POST http://${appname}-jmesnil.rhcloud.com/test/
val=1
$ curl -X POST http://${appname}-jmesnil.rhcloud.com/test/
val=2

Even though Redis is not officially supported by OpenShift yet, it is still possible to use it now and it is very simple to deploy and run it.