Saturday, March 5, 2011

How to sniff network traffic from another machine connected to the switch

Assume that there are two machines (A and B) connected to the switch. You want to sniff the network traffic between them with another box (Sniffing machine C) connected to the same switch. NIC of sniffing machine C (even when set to promiscuous mode) cannot see messages exchanged between A and B, because switch creates virtual connection based on the MAC addresses of these machines.



Assuming that you have privileges to configure switch, you can create port mirroring between switch port involved in the traffic (1 or 2) and sniffing port (3). 

Port mirroring allows you to copy network traffic from one port of the switch to another. For example you create port mapping from port 1 (Machine A) to port 3 (Machine C). Now you listen on machine C using promiscuous mode and you can see traffic between A and B boxes.

On Linksys/Cisco routers you can configure port mirroring by entering web setup of the box and navigating to the Admin -> Port Mirroring section.

Please note that some switches allow you to mirror more than single port to the monitoring one. Make sure that bandwidth of the single port can handle entire traffic from all ports mirrored to it. Otherwise your switch can go wild or refuse to handle any packages at all.

Propagation of business changes in transformation components

Few days ago I started to write about separating business logic from message translation in middleware systems. Today I share some further thoughts concerning this issue. Particularly how message translation model usually looks like and what can we redesign it in order to make it more elegant.

Gregor Hohpe in his famous EIP book described message translation as a component of messaging infrastructure that is responsible for performing modifications on the incoming message.



Message translator can enrich, as well as reduce, the content of the message. In extreme cases translator can even replace incoming message entirely with the new content. While EIP book lists and describes possible transformations that can be executed against the incoming message (wrapping in envelope, enriching, filtering, normalizing an so forth), it does not discuss the possibility of delegation of the translation logic to the external business component.

Business requirements tend to change frequently during the software system development. Moreover, even when application is already built and deployed, it is still very likely that business rules are going to change. In general integration architects can safely assume that business requirements are going to evolve and being modified during the lifetime of the system.

If system architect decides to include business logic in the transformation components, then all changes to the business rules affect also translation modules (and therefore messaging infrastructure).



    Implications of such approach are (just to mention few of them):
  • Violation of Separation Of Concerns principle between messaging and business layers of the system.
  • Low reusability of the both middleware and business components of the system.
  • Worse maintainability of both business rules and the transformation components.
  • Problems with distribution of the tasks within the team (since analysts have to work on the same component as the integration architects and engineers).
  • Unnecessary redeployment of the messaging infrastructure on changes of the business rules.

What we would like to achieve is transformation model where business changes affect only business components of the system. In our perfect model message transformation should depend on business logic, but still be unaware of the business rules details. Therefore internal changes within the business components would not affect the messaging infrastructure.



In next posts I'll cover the latter model in more details (including Apache Camel and JBoss Drools solution) and present some experience of mine in the area of the discussed issue.

Wednesday, March 2, 2011

Motivation to separate business rules from the message enriching

Transformation of the messages is one of the key functionalities provided by the middleware systems. There is a lot of existing and production-ready solutions which can be applied to the majority of the business problems. The most of the serious business issues require quite complex messaging solutions. And when integration infrastructure begins to grow, maintainability of the message routing structure becomes an issue.

One of the main factors affecting the complexity of the middleware solution, is the necessity of including business rules in the messages routing structure. Business requirements use to change and such changes propagate to the entire structure of the integration architecture. Floating requirements in the software system always generate costs, but changes in the messaging infrastructure are one of the most expensive ones.

What integration architect can do to minimize the costs following changing business requirements, is to apply the Separation Of Concerns principle between business logic and the messaging infrastructure.

The area of messaging that heavily depends on business logic is message transformation. Operation that changes message (i.e. perform enriching, filtering, normalization, etc.) usually performs such task with close cooperation with the business components of the system. Message transformation would be then an excellent target of optimization by applying Separation of Concerns principle.

In next posts I'll focus on the message enriching operations performed on the messaging infrastructure. I'll write about patterns that can be applied to this kind of transformations. And of course provide possible implementation created in Java language backed by the Apache Camel and JBoss Drools frameworks.

Stay tuned.

Sunday, January 30, 2011

My top company web sites

Together with ioGreen guys we're working on our new web site. The key issue about it's new version is that it need to be more business-oriented and "serious".

We decided that each of us have to find five of his favorite company pages. Then we will compare them and choose the best.

Here are my top 5 for this moment (in order). Please note that pages are intended to be "serious" in design. No magic minimal web pages from Site Inspire.
I prefer lightweight and minimal web design. However Java middleware-oriented companies use to be serious and heavy in design. There are many spiffier pages. But my top pages find good balance between business (heavy) and lightweight web design.

Your favorites?

Sunday, January 16, 2011

Wetware - My learning schema

Inspired by SQ3R learning method described in Refactor Your Wetware. Here is the learning method that works best for my humble person:
  •  acquire learning resources about the topic you want to learn. Buy books, download articles, podcasts, Youtube videos, search in Google Reader and so on.
  • create survey based on the acquired learning resources. Read tables of contents, articles leads, etc. At this point try to specify what do you want to learn (specific objectives).
  • read the content of the resources. How one gets to Carnegie Hall? Meta-learning techniques is the one thing, but you actually have to acquire the knowledge. Read, read and read once again.
  • ask yourself inquiring questions about the content (and write them down). Be courious while reading. Be hunger for the answers. Write down all your doubts that occur during the lecture. Asking the right questions is the form of learning as well.
  • rephrase the content (and answer the questions). Process what you've just read. Try to apply the facts to the questions you asked before.
  • summarize the questions and answers - then write them down.
  • iterate from the first step again if you want to become even better in the topic. 
Key activities regarding the learning process above:
  • asking questions
  • trying to identify the most specific objectives of the learning process
  • reading (listening to) the resources
  • answering your own questions using the rephrased expressions
  • writing down the questions and answers

Tuesday, January 11, 2011

Camel Extra 2.5.0 officially released

Two days ago we released Camel Extra 2.5.0 . It is now available at Camel Extra Maven repository.

There was some problems with Camel Extra being released together with the main Camel distribution. Due to that problems people using latest Camel-Extra modules used to download the Camel-Extra Maven project and build it locally. Such approach was immature and annoying at least. We promise that starting with 2.5.0 release we will always deploy the latest Camel-Extra together with the main Camel distribution. No more mandatory local builds from this point :) .

In order to use the latest stable version of the Camel Extra use the following repository:
<repository>
  <id>camel-extra-release</id>
  <name>Camel Extra Maven repository of releases</name>
  <url>http://camel-extra.googlecode.com/svn/maven2/releases</url>
</repository>

You may ask why Camel Extra cannot be synchronized and hosted in the same repository as main Camel distribution (Apache repository for example). Actually that's good question. But stay tuned - we're working on that issue :) .

Thursday, January 6, 2011

Committed JiBX data format for Camel

I have just committed new JiBX data format to the Apache Camel project.

Camel is an amazing routing engine serving as a core for the best ESB implementation ever i.e. ServiceMix. JiBX is the high performance XML binding library for Java.

Since now you can (un)marshal your Camel messages with out of the box JiBX support, without need to create your custom JiBX components.

New JiBX component will be available with the 2.6.0 release of Apache Camel.

You can use JiBX component with both Java DSL...

// Marshal message to XML using Java DSL.
from("activemq:My.Queue").
  marshal().jibx().
  to("mqseries:Another.Queue");

// Unmarshal message from XML.
from("mqseries:Another.Queue").
  unmarshal().jibx(PurchaseOrder.class).
  to("activemq:My.Queue")

... and Spring DSL...

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

  <!-- Define data formats -->
  <dataFormats>
    <jibx id="jibx" unmarshallClass="org.apache.camel.dataformat.jibx.PurchaseOrder"/>
  </dataFormats>

  <!-- Marshal message to XML -->
  <route>
    <from uri="direct:marshal"/>
    <marshal ref="jibx"/>
    <to uri="mock:result"/>
  </route>

  <!-- Unmarshal message from XML -->
  <route>
    <from uri="direct:unmarshal"/>
    <unmarshal ref="jibx"/>
    <to uri="mock:result"/>
  </route>

</camelContext>

Enjoy.