Smooks Structured Event Flow processing

Source: Internet
Author: User
Tags filter json object model

Overview

Smooks is an open source Java framework for handling "data event streams." It is often considered a transformation framework and used in several products and projects, including the JBoss ESB (and other ESB). At its core, however, Smooks does not mention "conversion" or any other relevant vocabulary. It's applied far more than that!

Smooks's job is to turn the structured/hierarchical data flow into an "event" stream, and then make an analysis of the "Visitor logic (Visitor Logic)" To produce the results (optional).

SOURCE-> Structured Event flow (visitor logic)-> results

So what are some of the things that this tool can do, and tools such as sax and Dom can't do? Given that Smooks is built on these technologies, the simple answer is "No." The real value of smooks is that it is easier to consume sax and Dom (Smooks now does not support Stax based filters). It provides a visitor API and a configuration model that allows you to easily set the target of the visitor's logic to specific SAX events (if you are using a sax filter) or DOM elements (if you are using a DOM filter). Smooks also simplifies consumption of non-XML source data formats (Edi,csv,json,java, etc.) in a standard way, that is, the standard event flow generated by the data source becomes the de facto canonical form of all these different source data formats. This is the key to Smooks's work!

There are two ways to use Smooks, and you can use one or the other in combination:

Mode one: You can fully invest in smooks, write your own custom visitor logic event handler, and use it to handle a specific event in a data source event stream. Using this pattern, you must familiarize yourself with the core APIs.

Mode two: You can reuse the out-of-the-box solution provided by the smooks distribution, and the number is growing. In this mode, you simply reuse the components created by others and reconfigure them to process your data source, for example, by configuring some parameters to generate a Java object model from an EDI data source.

In this article, we'll take a quick look at some out-of-the-box features from the Smooks v1.1 release, which are features you don't need to write any code to take advantage of (i.e. Mode II). This includes:

Multi-source data format: "Easily" consume many popular data formats, including Xml,edi,csv,json and Java (yes, you can do Java conversion in a declarative way).

Transformations: The use of many options to consume the flow of events generated by the data source, resulting in other formats (i.e., "converting" to the source). This includes the ability to apply Freemarker and XSL templates to the data model captured by Smooks when filtering the source data stream. Since these template resources can be used to source events within the data event stream, they can be used to perform "Fragment based Transformations (fragment based transforms)". This means that smooks can be used to perform transformations on fragments of a data source, rather than just the data source as a whole.

Java bindings: Create and generate Java object models/diagrams in a standard way by supported data formats, that is, not limited to XML. The configuration of an object model generated by an EDI data source is almost identical to the configuration made by an XML data source or JSON data source generation object model. The only difference is that the event selector value for the binding configuration is different.

Large message processing: Smooks supports a variety of ways to handle large messages (GBs), which are done through a sax based filter. Because of the combined capabilities of fragment conversions, Java bindings, and the ability to mix the DOM and Sax models with the node model, Smooks can handle large messages with lower memory space. These capabilities allow you to perform a direct 1 to 1 conversion, while also supporting 1 to multiple decomposition, transformation, and routing of large message streams.

Message decoration: Use database data to modify messages. This can be done by a fragment, that is, you can manage the decorations on a piece by fragment. One use case associated with this is a message that contains a list of consumer IDs that needs to be extracted from the database to extract consumer addresses and profile data before sending to another process.

Configuration model based on extensible xsd: starting with Smooks v1.1, you can extend the Smooks XSD configuration namespace with your own reusable custom visitor logic configuration model. Creating these custom configuration extensions is just a simple configuration effort that greatly enhances the usability of these reusable components. This tool is used by all of the existing Smooks preset components.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.