It has been an amazing time so far for me working at SpringSource for the past couple of months and today I have finally published my first blog post for the official SpringSource blog. The blog post also marks the Milestone 1 (M1) release of the Cloud Foundry Maven Plugin which will make it much easier for Maven users to deploy their applications to Cloud Foundry.
Thus, checkout the blog post, use the plugin and follow the project over at GitHub. Please provide plenty of feedback - it is highly appreciated!
Thursday, September 22, 2011
Friday, July 29, 2011
OSCON 2011 - Mission Accomplished
OSCON 2011 - Mission Accomplished and a week of amazing learning and networking is finally coming to an end. I had flown in not only for OSCON Java but also for the Community Leadership Summit, that took place last Saturday and Sunday (but Sunday, I attended the JVM languages day instead, which was wonderful as well).
I was super-impressed with the variety of people from all over the planet, not only the US but also Europe and the Americas. E.g. if you saw somebody wrapped in a flag…that was Bruno Souza, the man that has put Brazil on the map for Java developers. Furthermore, all the cool open-source companies that you could ever think of were present as well. Just an awesome level of energy there.
Also, I was able to connect with a ton of VMware/SpringSource folks at the event that I hadn’t met personally before, yet. Just to give you an idea of how awesome the open-source community is: On Tuesday we went out for some great food at McMenamins Kennedy School. It is housed in an old school with everything left intact/restored (incl. the showers in the rest rooms). That place has 5 bars, restaurant and excellent outdoor seating.
Anyway, our group included Dan Allen from JBoss (member of the Seam, Weld and Arquillian projects), Peter Neubauer from Neo4J (Founder, good chance for me to speak some German ;-), William Rowe from SpringSource (Apache Foundation Vice President, HTTP Server), David Blevins from IBM (Co-founder of Geronimo and OpenEJB), Mark Johnson from SpringSource (President of NEJUG), Bruce Snyder from SpringSource (ActiveMQ comitter), Josh Long from SpringSource (Developer advocate and author), Steve Mayzak from SpringSource (Author). Seriously, to me, this was like being backstage! Thanks for having the chance to meet you all!
Back to OSCON here are the sessions I was able to attend:
Monday
- Theory of Caching (Greg Luck)
- Java Puzzlers – Scraping the Bottom of the Barrel (Josh Bloch, Bob Lee)
- The Ghost in the VM: A Reference to References (Bob Lee)
Tuesday
- Everything You Wanted to Know about Open Source that Nobody Told You (Jeff Genender)
- Managing Thousands of Cloud Instances with Java (Patrick Lightbody)
- ActiveMQ in Action – Common Problems and Solutions (Bruce Snyder)
- The Evolution of Java: Past, Present, and Future (Josh Bloch)
- From Ruby on Rails to Java: The Gory Details (Steve Jenson)
- A Giant Hop Forward with Spring Roo (Steve Mayzak and Josh Long
Thursday, July 21, 2011
Priority Channels in Spring Integration
As somebody was asking about a Priority Channel example for Spring Integration in the forums today, I went ahead and created a simple example. You can grab the source code over at GitHub:
https://github.com/ghillert/spring-integration-examples/tree/master/priority-channel-example
For some additional information check out the related forum entry:
http://forum.springsource.org/showthread.php?112368-PriorityQueue-example-needed
https://github.com/ghillert/spring-integration-examples/tree/master/priority-channel-example
For some additional information check out the related forum entry:
http://forum.springsource.org/showthread.php?112368-PriorityQueue-example-needed
Monday, July 4, 2011
HTML5 WebSockets for JVM Developers
Anything related around HTML5 seems to be a hot button topic these days and lucky for me that I got an opportunity to take a deep dive into WebSockets. Thus, I will use this blog to post my findings over the next few days and I will present some simple code examples as well.
Anyway, WebSockets allow Servers to basically "push" data back to subscribed Browser clients in an effective manner instead of using workarounds such as long-polling. The WebSockets API is being standardized by the W3C (http://dev.w3.org/html5/websockets/) and the actual protocol is being defined by the Hypertext-Bidirectional (HyBi) working group (Part of IETF) - http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-09.
For further reading and to learn more about WebSockets in general, please also check out the following resources:
Firefox 6 is supposed to bring back websockets support, albeit using a newer draft of the websocket protocol (hybi-07), which is not backwards compatible.
What about Web Servers?
Okay, so WebSockets look cool, yet with limited browser support. Furthermore, different webservers have varying stages of support for asynchronous messaging, with Jetty and Glassfish being the best options currently a provide native websocket support. It looks like Resin also has direct websocket support. See also:
Tomcat 7 currently does not support WebSockets, yet. Check out the following issue tracker entry to learn more about the current state of affairs in Tomcat 7:
What's next?
So, essentially what we want is some kind of framework that supports "graceful degradation": when available a suitable framework shall use websockets, but if not available, the framework should fall back to more traditional push work-arounds such as long-polling.
On the server-side, I am running Java, and therefore, I need a respective implementation on that platform. Choices, though, seem to be rather limited and I came up with the following list of options:
Socket.IO looks like it has quite some traction but the default implementation is for Node.JS. There are Java implementations available but they did not seem to have much traction. jWebSocket actually looks promising but its licensing (LGPL) is too restrictive to me (My choice needs to be Apache license compatible ;-).
Out of the list above, I chose Atmosphere (http://atmosphere.java.net/). Atmosphere has pretty much all the features you would like to have incl. detecting server-side capabilities and using the best possible approach transparently. Atmosphere comes with a jQuery plugin that abstracts away the implementation details (same Api for using long-polling vs. websockets)
While Atmosphere comes with quite a few examples, they are interestingly mostly for JAX-RS and there are no examples for Spring MVC. Also, the documentations is rather limited but luckily you get very swift and helpful responses from Atmosphere mailing list.
In my next posting, I will provide a little example integrating Spring MVC and Atmosphere. So stay tuned.
Nevertheless, if you have other WebSocket recommendations and/or thoughts, please leave comments!
PS:
A funny thing, I just realized that Burr Sutter, a friend of mine and fellow AJUG board member wrote down his WebSockets research experiences as well. It is a small world. Go check it out at:
Anyway, WebSockets allow Servers to basically "push" data back to subscribed Browser clients in an effective manner instead of using workarounds such as long-polling. The WebSockets API is being standardized by the W3C (http://dev.w3.org/html5/websockets/) and the actual protocol is being defined by the Hypertext-Bidirectional (HyBi) working group (Part of IETF) - http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-09.
For further reading and to learn more about WebSockets in general, please also check out the following resources:
- http://www.html5rocks.com/en/tutorials/websockets/basics/
- http://websocket.org/
- https://developer.mozilla.org/en/WebSockets
- http://en.wikipedia.org/wiki/WebSockets
- http://hacks.mozilla.org/2010/12/websockets-disabled-in-firefox-4/
- https://developer.mozilla.org/en/WebSockets
Firefox 6 is supposed to bring back websockets support, albeit using a newer draft of the websocket protocol (hybi-07), which is not backwards compatible.
What about Web Servers?
Okay, so WebSockets look cool, yet with limited browser support. Furthermore, different webservers have varying stages of support for asynchronous messaging, with Jetty and Glassfish being the best options currently a provide native websocket support. It looks like Resin also has direct websocket support. See also:
Tomcat 7 currently does not support WebSockets, yet. Check out the following issue tracker entry to learn more about the current state of affairs in Tomcat 7:
What's next?
So, essentially what we want is some kind of framework that supports "graceful degradation": when available a suitable framework shall use websockets, but if not available, the framework should fall back to more traditional push work-arounds such as long-polling.
On the server-side, I am running Java, and therefore, I need a respective implementation on that platform. Choices, though, seem to be rather limited and I came up with the following list of options:
- Atmosphere (http://atmosphere.java.net/)
- Socket.IO (http://socket.io/) - Orginally for Node.JS there are Java implementations available
- jWebSocket (http://jwebsocket.org/)
- Stomp Websocket for HornetQ and ActiveMQ (http://jmesnil.net/stomp-websocket/doc/)
- https://github.com/maccman/juggernaut
- https://github.com/socky/socky-server-ruby
- https://github.com/igrigorik/em-websocket
Socket.IO looks like it has quite some traction but the default implementation is for Node.JS. There are Java implementations available but they did not seem to have much traction. jWebSocket actually looks promising but its licensing (LGPL) is too restrictive to me (My choice needs to be Apache license compatible ;-).
Out of the list above, I chose Atmosphere (http://atmosphere.java.net/). Atmosphere has pretty much all the features you would like to have incl. detecting server-side capabilities and using the best possible approach transparently. Atmosphere comes with a jQuery plugin that abstracts away the implementation details (same Api for using long-polling vs. websockets)
While Atmosphere comes with quite a few examples, they are interestingly mostly for JAX-RS and there are no examples for Spring MVC. Also, the documentations is rather limited but luckily you get very swift and helpful responses from Atmosphere mailing list.
In my next posting, I will provide a little example integrating Spring MVC and Atmosphere. So stay tuned.
Nevertheless, if you have other WebSocket recommendations and/or thoughts, please leave comments!
PS:
A funny thing, I just realized that Burr Sutter, a friend of mine and fellow AJUG board member wrote down his WebSockets research experiences as well. It is a small world. Go check it out at:
Tuesday, May 24, 2011
Testing Email Notifications with Apache James 3.0
On windows machines I have been using Mailster for testing email notifications. Unfortunately, I had issues with Mailster in the past running on non-Windows machines. Thus, on Mac I have been using a local Postfix instance, which forwarded email to dedicated (real) mailboxes. But, it involved a bit of customization and ultimately I had to "know" to which mailboxes I wanted to send notifications to.
However, ideally I don't really care about email addresses. Instead I typically want to verify that the format and layout of the generated emails are good, be it text emails ort Html emails. Ultimately, it would be nice, if for testing, all notification sent ended up in ONE mailbox for development testing purposes.
Enter Apache James. Not long ago I came across this wonderful blog posting below about using Apache James 2.x in order to test application email notifications:
http://livingtao.blogspot.com/2007/05/testing-application-generated-emails.html
IT is amazing to see that this is pretty much the only dedicated blog posting on the internet regarding a seemingly very common issue. You would think that almost every serious enterprise application has to sent out email notifications, and be it solely for the "forgot password" feature. What is so fantastic about using Apache James, is that it allows you to test Email notifications, while sitting on a plane with no internet in sight. Just run everything locally.
Anyway, the steps illustrated in the blog above also work nicely for James 3.0 (currently milestone 2). What is pretty cool about Apache James is that it is now Spring-based :-)
Here are the simple steps to get things set up for Apache James 3.0:
However, ideally I don't really care about email addresses. Instead I typically want to verify that the format and layout of the generated emails are good, be it text emails ort Html emails. Ultimately, it would be nice, if for testing, all notification sent ended up in ONE mailbox for development testing purposes.
Enter Apache James. Not long ago I came across this wonderful blog posting below about using Apache James 2.x in order to test application email notifications:
http://livingtao.blogspot.com/2007/05/testing-application-generated-emails.html
IT is amazing to see that this is pretty much the only dedicated blog posting on the internet regarding a seemingly very common issue. You would think that almost every serious enterprise application has to sent out email notifications, and be it solely for the "forgot password" feature. What is so fantastic about using Apache James, is that it allows you to test Email notifications, while sitting on a plane with no internet in sight. Just run everything locally.
Anyway, the steps illustrated in the blog above also work nicely for James 3.0 (currently milestone 2). What is pretty cool about Apache James is that it is now Spring-based :-)
Here are the simple steps to get things set up for Apache James 3.0:
- Download Apache James 3.0
- Unzip the downloaded archive
- Edit mailetcontainer.xml in directory /conf/
- Search for "<processor name="transport">"
- Replace the entire element that starts with "<mailet match="All" class="RemoteDelivery">" with: "<mailet match="All" class="Forward"> <forwardto>test@localhost</forwardto></mailet>"
- Startup Apache James 3.0 using sudo /bin/run.sh (Sudo is needed for local permissions)
Connect via Telnet to Apache James using: telnet localhost 4555 (User: root password: root)Type: adduser test test <return>- ./james-cli.sh -h localhost adddomain localhost
- ./james-cli.sh -h localhost adduser test@localhost test
- Setup Thunderbird (or your favority email application)
I hope this gives you enough starting points for setting up email notification testing. Please leave comments if you see areas I can improve upon. Onward...
Saturday, April 30, 2011
Spring 3.1 Bean Definition Profiles - Use Case
As I am diving deeper into VMware's Cloud Foundry, I decided to make the DevNexus conference web-application fit for Cloud Foundry. However, instead of creating an explicit version of the application for Cloud Foundry, my goal is to have one War file that can be deployed without modifications to either CloudFoundry or a stand-alone servlet container.
Here one new Spring 3.1 feature comes in handy: Bean definition profiles. Bean definition profiles allow you to conditionally load Spring beans. There are some great resources already out there on how to use Bean definition profile, and thus I won't go into the details here:
Personally, I like to develop web applications that can run in a wide variety of environments with as little configuration as necessary. For my use-case, I want to create a single war file that can be deployed to the cloud, but which can also be deployed into your locally running Tomcat, Jetty, etc.
Furthermore, I believe that bean definition profiles can also be very useful for demo/integration testing purposes. For web applications, I like the concept of "application home directories". They contain configuration files (e.g. DB connectivity parameters), data files such as for Hibernate Search etc.) and the web application will reference the home directory either through a system property, environment variable or looks in a default directory in your user directory. But what if the home directory does not exist?
If the home directory does not exist, then the application runs in demo mode (or embedded mode), which means, the application use an embedded database for persistence and to also loads a set of seed+demo data at application startup-up.
Summarizing, I can think of the following Web application "modes" aka profiles:
Over the next few days I hope to deploy an updated DevNexus application to Cloud Foundry, so stay tuned for updates.
Here one new Spring 3.1 feature comes in handy: Bean definition profiles. Bean definition profiles allow you to conditionally load Spring beans. There are some great resources already out there on how to use Bean definition profile, and thus I won't go into the details here:
- http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/
- http://blog.springsource.com/2011/02/14/spring-3-1-m1-introducing-profile/
- http://it-republik.de/jaxenter/artikel/Spring-3.1-%96-Was-gibt%92s-Neues-3693.html (German)
- http://blog.iprofs.nl/2011/02/27/spring-3-1-environment-specific-configuration/
- http://blogs.jetbrains.com/idea/2011/04/new-in-105-spring-31-bean-definition-profiles/
Personally, I like to develop web applications that can run in a wide variety of environments with as little configuration as necessary. For my use-case, I want to create a single war file that can be deployed to the cloud, but which can also be deployed into your locally running Tomcat, Jetty, etc.
Furthermore, I believe that bean definition profiles can also be very useful for demo/integration testing purposes. For web applications, I like the concept of "application home directories". They contain configuration files (e.g. DB connectivity parameters), data files such as for Hibernate Search etc.) and the web application will reference the home directory either through a system property, environment variable or looks in a default directory in your user directory. But what if the home directory does not exist?
If the home directory does not exist, then the application runs in demo mode (or embedded mode), which means, the application use an embedded database for persistence and to also loads a set of seed+demo data at application startup-up.
Summarizing, I can think of the following Web application "modes" aka profiles:
- Embedded mode (Integration testing and Demo mode)
- Cloud Foundry mode (e.g. reference the MySql service, don't use file-system properties)
- Stand-alone deployment mode (Uses home directory)
Thus, I can create a dedicated Bean definition profile in my Spring application context for each mode. Here is an example I have:
What about integration testing?
As of writing this blog posting the latest Spring 3.1 release is: 3.1.0.M1 and there is no explicit support for selecting profiles in your test declaratively. There is, though, the following new feature request Jira:
https://jira.springsource.org/browse/SPR-7960 - "TestContext framework should support declarative configuration of bean definition profiles"
This feature is scheduled for Spring 3.1 M2, but in the meantime, I use a static block which does the trick:
<beans profile="default">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="searchSystemEnvironment" value="true" />
<property name="locations">
<list>
<value>file:${TING_HOME}/ting.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${database.jdbc.driverClassName}" />
<property name="url" value="${database.jdbc.url}" />
<property name="username" value="${database.jdbc.username}" />
<property name="password" value="${database.jdbc.password}" />
<property name="maxActive" value="100" />
<property name="maxIdle" value="30" />
<property name="maxWait" value="1000" />
<property name="poolPreparedStatements" value="true" />
<property name="defaultAutoCommit" value="true" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter" />
<property name="persistenceUnitName" value="base" />
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">${database.hibernate.dialect}</prop>
<prop key="hibernate.query.substitutions">true '1', false '0'</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
<prop key="hibernate.show_sql">${database.hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean>
</beans>
<beans profile="cloud">
<cloud:data-source id="devnexus-db"/>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="devnexus-db" />
<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter" />
<property name="persistenceUnitName" value="base" />
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.query.substitutions">true '1', false '0'</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">create-drop</prop>
</props>
</property>
</bean>
</beans>
<beans profile="embedded">
<jdbc:embedded-database type="H2" id="dataSource"/>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter" />
<property name="persistenceUnitName" value="base" />
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.query.substitutions">true '1', false '0'</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
</props>
</property>
</bean>
</beans>
What about integration testing?
As of writing this blog posting the latest Spring 3.1 release is: 3.1.0.M1 and there is no explicit support for selecting profiles in your test declaratively. There is, though, the following new feature request Jira:
https://jira.springsource.org/browse/SPR-7960 - "TestContext framework should support declarative configuration of bean definition profiles"
This feature is scheduled for Spring 3.1 M2, but in the meantime, I use a static block which does the trick:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
locations={
"classpath:spring/applicationContext-core-data.xml",
"classpath:spring/mainApplicationContext.xml"
})
public abstract class BaseDaoIntegrationTest {
static {
System.setProperty("spring.profiles.active", "embedded");
}
protected @PersistenceContext(unitName="base") EntityManager entityManager;
}
Over the next few days I hope to deploy an updated DevNexus application to Cloud Foundry, so stay tuned for updates.
Thursday, April 14, 2011
First explorations into SpringSource's CloudFoundry
I received my credentials last night for SpringSource's CloudFoundry and I am now in the process of going through the examples. Next, I plan to make some of my applications (home-projects) work on the cloud. The general documentation so far seems to be a still a bit scattered. Therefore, below I summarize all the documentation and resources I have used so far to immerse myself into the services provided by the CloudFoundry. Hopefully it provides a good starting point for you as well.
Background information
Deploy Applications to the cloud from within Eclipse (STS)
Deploy Applications to the cloud using the command line tool vmc
Spring Roo Support
Groovy/Grails
Further reading
Mark Fisher published a great general article covering both, the vmc command line tool and Eclipse:
Make also sure you hit the forums:
And when you really want to look under the hood, take a look at the source code for CloudFoundry at:
It seems like that when checking out CloudFoundry, it is also a great opportunity to familiarize yourself with Spring 3.1 (see this Spring blog post detailing some of the new features). While I think it is not strictly required it provides functionality that is quite useful for cloud deployment scenarios such as:
Background information
- http://blog.springsource.com/2011/04/12/launching-cloud-foundry/
- http://www.youtube.com/cloudfoundry
Deploy Applications to the cloud from within Eclipse (STS)
Deploy Applications to the cloud using the command line tool vmc
Spring Roo Support
Groovy/Grails
Further reading
Mark Fisher published a great general article covering both, the vmc command line tool and Eclipse:
Make also sure you hit the forums:
And when you really want to look under the hood, take a look at the source code for CloudFoundry at:
It seems like that when checking out CloudFoundry, it is also a great opportunity to familiarize yourself with Spring 3.1 (see this Spring blog post detailing some of the new features). While I think it is not strictly required it provides functionality that is quite useful for cloud deployment scenarios such as:
- Bean definition profiles (Useful to cover both, local and cloud deployment)
- Spring's new Environment abstraction
Monday, April 4, 2011
Spring Integration - Camellos Continued
We had a great DevNexus conference this year and we were extremely blessed, that the project leads of both, Apache Camel (Claus Ibsen) and Spring Integration (Mark Fisher), spoke at the conference. In my opinion both frameworks are probably the best integration frameworks on the JVM!
Back in late 2009 I had written a blog post, where I presented some results from my Apache Camel learning experience. Now in 2011 it is time to do the same for Spring Integration. I am in the process of creating a few examples for Spring Integration that I create while learning it. So my hope is to create a little series of blog posts covering Spring Integration and Enterprise Integration Patterns (EIP) in general.
Nevertheless, don't forget to check out the wonderful examples that are provided via the Spring Integration Git repo at: http://git.springsource.org/spring-integration/samples/. It contains a sophisticated list of examples and is the best place to get started.
Well, let's get started - The source code for my example is available via GitHub, and will be successively expanded with additional examples in the coming weeks:
java -jar camellos-si.jar
That's it. Spring Integration should boot up and you can drop files you want to zip up into '/camellos-si/data/inbox/'.
* * *
Some interesting additional features covered by my example:
Maven Shade Plugin (http://maven.apache.org/plugins/maven-shade-plugin/)
The Maven Shade Plugin can be a nice simplifier in stand-alone deployment scenarios. Let's say you have a project with multiple jar dependencies, then you can use this plugin to merge all jar dependencies into one single jar. You can also configure the Maven Shade Plugin so that it generates the Main-Class property in META-INF/MANIFEST.MF and consequently, you can deliver a single jar (No class-path hell) and execute the application like my simple example:
java -jar camellos-si.jar
Maven Assembly Plugin (http://maven.apache.org/plugins/maven-assembly-plugin/)
The Maven Assembly plugin helps with creating distributable packages. For instance for my example I need not only the compiled jar file but I also need a few directories in the right place, e.g. Apache FtpServer requires the users.properties file to be an actual file (having it as a class path resource embedded in your jar won't work).
Basically, you can use the Maven Assembly Plugin to move things around and to mold your resulting distributable package (a Zip file in my case).
Embedded Ftp Server using Apache FtpServer (http://mina.apache.org/ftpserver/)
Something I always find intriguing with Spring is the simple embedability of additional services such as running ActiveMQ embedded in your Spring context by just adding a single line of Xml, or in this case embedding Apache FtpServer. I know it is a blurry line where you start building your own application server but mentally I still find it easier to do it in Spring than using an app server, particularly when you only want to do it for testing, showcasing etc. and move on to use external ActiveMQ, Ftp Server instances for production etc.
I hope this example has been enlightening for your own Spring Integration discoveries - stay tuned for more.
Back in late 2009 I had written a blog post, where I presented some results from my Apache Camel learning experience. Now in 2011 it is time to do the same for Spring Integration. I am in the process of creating a few examples for Spring Integration that I create while learning it. So my hope is to create a little series of blog posts covering Spring Integration and Enterprise Integration Patterns (EIP) in general.
Nevertheless, don't forget to check out the wonderful examples that are provided via the Spring Integration Git repo at: http://git.springsource.org/spring-integration/samples/. It contains a sophisticated list of examples and is the best place to get started.
Well, let's get started - The source code for my example is available via GitHub, and will be successively expanded with additional examples in the coming weeks:
- https://github.com/ghillert/camellos-spring-integratio
- git://github.com/ghillert/camellos-spring-integration.git
- A user drops a file in a local directory (/camellos-si/data/inbox/), that is continuously polled by Spring Integration.
- The file is picked up by Spring Integration and converted to a byte array with the original file being deleted.
- The resulting byte array is sent to an in-memory channel.
- A custom transformer will pick up the data array and compress the data using a ZipOutputStream
- The resulting byte array is yet again being sent to another channel.
- Finally an Outbound Channel Adapter will grab the data from the channel and send it via Ftp to an embedded Ftp server (stored under: /camellos-si/data/ftp/).
java -jar camellos-si.jar
That's it. Spring Integration should boot up and you can drop files you want to zip up into '/camellos-si/data/inbox/'.
* * *
Some interesting additional features covered by my example:
Maven Shade Plugin (http://maven.apache.org/plugins/maven-shade-plugin/)
The Maven Shade Plugin can be a nice simplifier in stand-alone deployment scenarios. Let's say you have a project with multiple jar dependencies, then you can use this plugin to merge all jar dependencies into one single jar. You can also configure the Maven Shade Plugin so that it generates the Main-Class property in META-INF/MANIFEST.MF and consequently, you can deliver a single jar (No class-path hell) and execute the application like my simple example:
java -jar camellos-si.jar
Maven Assembly Plugin (http://maven.apache.org/plugins/maven-assembly-plugin/)
The Maven Assembly plugin helps with creating distributable packages. For instance for my example I need not only the compiled jar file but I also need a few directories in the right place, e.g. Apache FtpServer requires the users.properties file to be an actual file (having it as a class path resource embedded in your jar won't work).
Basically, you can use the Maven Assembly Plugin to move things around and to mold your resulting distributable package (a Zip file in my case).
Embedded Ftp Server using Apache FtpServer (http://mina.apache.org/ftpserver/)
Something I always find intriguing with Spring is the simple embedability of additional services such as running ActiveMQ embedded in your Spring context by just adding a single line of Xml, or in this case embedding Apache FtpServer. I know it is a blurry line where you start building your own application server but mentally I still find it easier to do it in Spring than using an app server, particularly when you only want to do it for testing, showcasing etc. and move on to use external ActiveMQ, Ftp Server instances for production etc.
I hope this example has been enlightening for your own Spring Integration discoveries - stay tuned for more.
Tuesday, March 8, 2011
DevNexus 2011 - Tools to Get Stuff Delivered
Dear fellow developers,
DevNexus 2011 is only 2 weeks away (March 21-22) and if you haven't registered, yet, please seize the moment and register at http://www.devnexus.com/. Please hurry as registration is closing in one week.
Already, we are pleased to note that we surpassed the number of attendees compared to last year's conference. A big THANK YOU to all of you that registered so far!!
We will be having several raffles: an iPod Nano provided by JBoss, a Flash Builder 4 Premium license provided by Adobe and we will raffle a selection of books. Zero Turnaround is giving to every attendee a JRebel + Enterprise Add-on licenses (for 4 months).
And that is not all! We will have a cocktail hour on March 21st, which is an awesome opportunity to network, talk to speakers and enjoy free drinks.
DevNexus 2011 is your chance to learn about the latest trends in mobile application development, UI frameworks, NoSQL, core Java technologies and the latest from JBoss, Springsource and much more.
This year we also have a focus on Tools and Best Practices that make you more productive as a developer which encompasses an exciting set of sessions such as:
Git Foundations and Advanced Git Tricks
http://www.devnexus.com/s/ presentations#1119
http://www.devnexus.com/s/ presentations#1120
Gradle
http://www.devnexus.com/s/ presentations#1115
Arquillian
http://www.devnexus.com/s/ presentations#1152
Selenium RC
http://www.devnexus.com/s/ presentations#1158
There are many more sessions to choose from - a total of 35 sessions (incl. 3 keynotes) across 4 parallel tracks. Our schedule is now finalized - Take a look at: http://www.devnexus.com/s/ schedule
Cheers,
DevNexus 2011 is only 2 weeks away (March 21-22) and if you haven't registered, yet, please seize the moment and register at http://www.devnexus.com/. Please hurry as registration is closing in one week.
Already, we are pleased to note that we surpassed the number of attendees compared to last year's conference. A big THANK YOU to all of you that registered so far!!
We will be having several raffles: an iPod Nano provided by JBoss, a Flash Builder 4 Premium license provided by Adobe and we will raffle a selection of books. Zero Turnaround is giving to every attendee a JRebel + Enterprise Add-on licenses (for 4 months).
And that is not all! We will have a cocktail hour on March 21st, which is an awesome opportunity to network, talk to speakers and enjoy free drinks.
DevNexus 2011 is your chance to learn about the latest trends in mobile application development, UI frameworks, NoSQL, core Java technologies and the latest from JBoss, Springsource and much more.
This year we also have a focus on Tools and Best Practices that make you more productive as a developer which encompasses an exciting set of sessions such as:
Git Foundations and Advanced Git Tricks
http://www.devnexus.com/s/
http://www.devnexus.com/s/
Gradle
http://www.devnexus.com/s/
Arquillian
http://www.devnexus.com/s/
Selenium RC
http://www.devnexus.com/s/
There are many more sessions to choose from - a total of 35 sessions (incl. 3 keynotes) across 4 parallel tracks. Our schedule is now finalized - Take a look at: http://www.devnexus.com/s/
We would also like to thank our sponsors, who help us tremendously by off-setting much of the substantial costs associated with this event:
Gold Sponsors
- Terracotta
- The Intersect Group
- Automated Logic Corporation
Silver Sponsors
- Blackberry
- Anteo Group
- 4t Networks
- ICE
- JBoss
Cocktail Hour Sponsor
- MATRIX
Please join us for this amazing event and register at: http://www.devnexus.com/
Thank you all and we will be delighted to see you in 2 weeks!
Cheers,
Gunnar
Thursday, March 3, 2011
Advanced Java, JRuby, Spring, Google, JBoss and DevNexus 2011
DevNexus 2011 - March 21st & 22nd (www.devnexus.com) - Registration will be closing soon.
Several large teams have already registered and this is the best event to have your team attend - the injection of new technologies, techniques and ideas from some of the world's best technologists as well has having other professional software developers to mingle with. We will soon hit max capacity for the event so please complete your registrations today.
The DevNexus organizing committee looks for the best speakers and hottest topics in the software development industry and this year we have had a tremendous response from notable presenters. The following are just a few of the DevNexus speakers:
com/s/speakers
http://www.ajug.org/ confluence/display/AJUG/ MailingLists
We look forward to seeing you at future AJUG Events and DevNexus 2011.
Sincerely,
Burr
770-714-3292
Several large teams have already registered and this is the best event to have your team attend - the injection of new technologies, techniques and ideas from some of the world's best technologists as well has having other professional software developers to mingle with. We will soon hit max capacity for the event so please complete your registrations today.
The DevNexus organizing committee looks for the best speakers and hottest topics in the software development industry and this year we have had a tremendous response from notable presenters. The following are just a few of the DevNexus speakers:
- Jevgeni Kabanov - the founder and CTO of ZeroTurnaround (JRebel) will be addressing JVM memory management and classloading - these are excellent sessions for your most hardcore Java coders
- Dick Wall - of the JavaPosse will dive into functional languages and overall best practices for software practitioners
- Bob McWhirter - the prolific founder of open source solutions such as Codehaus.org, Drools and Groovy will address Ruby/JRuby on his new project TorqueBox - the power of Ruby raised to the power of JBoss
- Claus Ibsen - the project lead for Camel and co-auther of the "Camel in Action" book will focus on enterprise integration
- Mark Fisher - the project lead for Spring Integration will address AMQP and the "Cloudy Future of Integration"
- Hans Dockter - the founder and project lead for Gradle will focus on automated build systems
- Hadoop
- Git
- Scala
- Arquillian
- Flex
- jQuery
- Sproutcore
- Selenium
- Gradle
- Apache Camel
- Spring Integration, Mobile, Social
- JBoss
- TorqueBox
- Apache Shiro
- GWT
- Google App Engine
- NoSQL
- The Future of Java
- ...
http://www.ajug.org/
We look forward to seeing you at future AJUG Events and DevNexus 2011.
Sincerely,
Burr
770-714-3292
Subscribe to:
Posts (Atom)


