Vicert @ Coding Serbia 2014, Novi Sad – Part I

Coding Serbia conference was held for the second time in Novi Sad. It is an international conference gathering domestic and international companies and IT professionals. 

Vicert attended the second day of the conference, on Friday, October 10. and here is a retrospective and our impressions of presentations held.

CodingSerbia

We split the blog post into two parts for easier reading. Enjoy the first part.

AngularJS workshop – Ben Ripkens/Bastian Krol

Within AngularJS workshop, all the participants should learn to work with AngularJS. First we had an introduction about javascript language and AngularJS  (basic syntax). After that we have installed virtual machines on our laptops. All necessary tools were installed and tuned, and participants started to solve AngularJS tasks. The speakers helped all participants in solving and understanding tasks. Workshop lasted 3 hours.

Some of the tasks

  • Add new router
  • Sort array (movie titles)
  • Add new movie in collection
  • Edit/Delete movie

https://angularjs.org/

Web Performance Elements With Gear5.me Use Case – Robert Gombaš and Nebojša Kamber

Infostud team presented their experiences regarding front-end performance optimizations and presented the crowd with their in house application for real time website monitoring called Gear5. Below are the subjects in their presentation.

  • Javascript loading, bottom of document, async loading
  • Distribute resources over multiple subdomains
  • DNS lookup times for domains/subdomains
  • Combine resources into fewer files and tradeoff when changing only a single resource (needs to recache all other stuff)
  • Caching
  • Typical web app time load 80% – frontend, 20% – backend
  • Measure tools. Web Relic (very popular), Gear5 (Infostud’s tool), GA, Pingdom
  • Third party ads, banners can cause loading/performance issues

MapReduce: Pig vs Java – Ozren Gulan and Dusan Zamurovic

Apache Pig is a platform for analyzing large data sets that consists of a high-level language for expressing data analysis programs, coupled with infrastructure for evaluating these programs. The salient property of Pig programs is that their structure is amenable to substantial parallelization, which in turns enables them to handle very large data sets.

Ozren and Dusan provided comparison of doing same Map Reduce task using Pig and the good way with Java. In fun and interesting way they demonstrated the strong and weak points of both approach. Below are the conclusions that they drew from their experience.

Pig pros

  • Fast development
  • Easy to use, out of the box functions
  • Pig Latin is familiar, SQL-like language.
  • User defined functions or UDP. It is possible to write custom functions in other third party languages.

Pig cons

  • Bad performance. (Around 4 times slower than same code manually written in Java)
  • No control over number of map and reduce jobs

Java pros

  • Wide spread technology
  • Superior performance
  • Manual control over number of map and reduce jobs

Java cons

  • It takes more time to write same functionality and it takes 10 more code lines

Enterprise Integration Patterns: Spring way – Dragan Gajic

Dragan Gajic made intro listing most used Enterprise Integration patterns, after which he went into more details about “Spring Integration” programming model, using a simple demo application for user registration and sending activation emails.

Spring Integration enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters. It allows separation of concerns, using messaging as its basis. One of the main benefits of using SI is that it allows jobs to be processed in parallel in background and also it makes system more robust as failure in part of the system will not influence the rest of it.

For example we may have a service which asks users to register and also to activate their account via activation email. In less robust systems registration part will be dependent on the part which sends emails. By using Spring Integration we can separate email sending functionality into separate service. Activation emails would be sent to queues which email sending service would consume. It would all work in independent and asynchronous mode.

Here we will cover Spring Integration in little more detail, than it was covered on the presentation. I used third party sources which can be found at the bottom of the section.

Messages that are exchanged in the Spring integration consist of:

  • Header (Sequence Number, Sequence Size, Expiration Date, Correlation Identifier, Return Address, Transport Info)
  • Payload

SI system consists of “Message Channels” and “Message Endpoints”.

Message Channel

  • Pollable channels. Queue, tyipically point to point, one producer and one consumer, usually used for “document” messages
  • Subscribable. Many consumers, doesn’t buffer it’s messages, usually used for “event” type of messages.
  • Decouples producers from consumers
  • Supports Point-to-Point or Publish/Subscribe
  • Enforces data type consistency

Message Endpoints

  • Adapters (connect your channel to some other system)
  • Filters (remove some message from channels based on header, content, etc.)
  • Transformers (convert a message content or structure)
  • Routers
  • Enrichers (add content to the message header or payload)
  • Service activators (invoke service operations based on the arrival of a message)

Adapters

Adapters connect your channel to some other system. They can be Inbound or Outbound. There are number of already built-in adapters, such as:

  • Stream adapters
  • File adapters
  • JMS adapters
  • JDBC adapters
  • FTP and Secure FTP adapters
  • Feed (rss, atom, etc.) adapters
  • Mail adapters
  • MongoDB adapters
  • UDP adapters
  • Twitter adapters

Filter

Filters are used to remove some message from channels based on header, content, etc. They sit between channels and allow or reject messages from one message channel to the next. There are number of built in filters, but custom filters can also be created. Custom filters are created by implementing SI MessageSelector interface.

Built in filters:

  • Expression filters
  • Xpath filter
  • XML validation filter

Transformers

Transformers convert a message content or structure. For example, convert an XML payload message into JSON payload message.

Built in transformers

  • XML to object/object to XML
  • Object to string/string to Object
  • File to string/string to file
  • Object serializer/deserializer
  • Object to map/map to object
  • Object to JSON/JSON to object

Beside the built in, you can also build your own custom transformers. Transformers provide support for Spring Expression Language SpEL.

Routers

They take messages from one channel and distribute the message to one or more other channels. Some routers must inspect a message to determine where to send the message.

Types of routers

  • Content routers
  • Recipient list routers

Enrichers

Enrichers are responsible to add content to the message header or payload. They are considered as variants of a transformer (always adding content). There are also number of built in enrichers and you can also build your own custom enrichers.

Service activator

Service activators invoke service operations based on the arrival of a message. The object or a bean serves as a service. The service is triggered (or activated) by the arrival of a message into the channel. Service method will receive parameter that can be arbitrary type or Message object. If service method returns a non-null value, the service activator will attempt to send a message conaining the return value to the configuration designate output channel. If there is a return value and no output channel, Spring checks the triggering message for a replyChannel header and sends the result to that channel.

Gateways

Gateways connect your channels without SI coupling. They serve as a facade to a Spring Integration system. They hide SI from the application. They can be Synchronous and Asynchronous. Applications must provide an interface to make requests of the SI system. Under the hood, SI will implement the interface with a org.springframework.integration.gateway.GatewayProxyFactoryBean . In order to make async gateway our interface method should all return Future objects (java.util.concurrent.Future).

Some of the Spring Integration points are taken from the following link: https://www.youtube.com/user/IntertechTraining/videos

All materials from the Coding Serbia conference can be found at the following link: http://saspes.com/en/2014/10/12/coding-serbia-conference-2014/

Tech Team

Author: Tech Team

When a couple of our Devs and TLs come together magic happens!

Leave a Reply

Your email address will not be published. Required fields are marked *