Thing which seemed very Thingish inside you is quite different when it gets out into the open and has other people looking at it

Monday, September 5, 2016

iPad Apps helps autistic children to spread their wings

Today there is app for everything, for maths, science, history, music and many more. Can these apps be useful for children with special needs? Kids with special needs cannot use the traditional approaches in learning, specially kids with autism need extra help than the rest of these children. They find it bit hard to focus on the things you teach, and process the information that is targeted. For kids like this Apps can be a life saver.

There  is an app for every skill you want to impart. For example there are apps targeted:

      • Improve Attention Span
      • Communication
      • Eye Contact
      • Social Skills
      • Motor co-ordination
      • Language and literacy
      • Time Management
      • Emotional Skills and Self Care

There are many apps in the appstore that facilitate Augmentative and Alternative Communication (AAC ) which can be highly use for autistic kids who are non verbal or speech partially impaired. These apps use text to speech technology, where kids can type words, or drag and drop images to communication with others on their needs.

Here are some of the reasons why iPad apps are so attractive for the kid's with autism and why they simply love it.
  • Visual Learning - Children with autism tend to learn more visually or by touch. In most cases they struggle with instructions given in the traditional school setting. Therefore, ipad provides an interactive educational environment to help them learn.
  • Structured and Consistent - Autistic children prefer devices compared to humans mostly because they are structured and constant. The voice is constant phase is constant, and they like things to be orderly and the ipad waits, which is something most human educators lack.
  • Promote independent learning and gives immediate feedback - Some apps which were build for ASD gives sensory re-enforcement to the child and when giving negative feedback, it chose to give it smoothly without any loud noises to distract the child.
  • Diverse Therapeutic Resource - Technology evolves and expand rapidly, so every day you see new apps with lot of creativity. Kids will not get bored, and the apps they use will get updated time to time
  • Cost Effective - Compared to other therapeutic resources ipad is inexpensive. For example Assistive Technology Devices such as Saltillo, Dynavox, Tobil cost much more than the iPad.
  • Socially Desirable and Portable- Most of therapeutic devices can lead to bullying in school, for kids with special needs. But if you give a child with an iPad, this makes the child popular at school (because every other kid likes to use iPad).
  • Apps can be easily customised - Most apps which were developed targetting autism can be customised, you can add your unique videos, images and voice to these apps. Specially the language and communication apps, so the child can learn from the things they see in their day to day life.

Here are some of the common iPad apps which target Communication, Social, Emotional and Linguistic Skills.
    • Communication - Tap to talk, iComm, Look2Learn, voice4u, My Talk Tools, iCommunicate, Proloqu2go, Inner Voice.
    • Social Skills - Model Me Going Places, Ubersense, TherAd, iMove (these apps will mostly do video self modelling social stories and give step by step  guidance for social stories such as brushing their teeth, going for a hair cut etc).
    • Linguistic Skills - First Phrases, iLanguage/ Language Builder, Rainbow Sentences, Interactive Alphabet, Touch and Write.
    • Emotional Skills - Smarty Pants.
Special Note for Educators, Teachers and Parents

Even though, there is a vast amount of apps available today, iPad is not a baby sitter, you should always be present when educating your child. The educational apps are their to help your child develop some cognitive processors or enhance their skills at reading, writing, spatial reasoning or just a way of communication. However, in order your child to grow, there should be an educator present when child is learning.. It can be a great tool and a resource for educational development but all things should come in moderation and also under supervision. It's actually quality of teaching and support that gives a positive out come, not just the device.

Sunday, September 4, 2016

Autistim ..the good, the bad and the ugly

Autism or Autism Spectrum Disorder is a brain based disorder which makes the brain function in a different way compared to the rest of the wold.

 Autism affect three major area's of a person;

  1. Social Interaction - Autistic people do not like to socialise, and they tend to be in their own world, they find it very hard to keep eye contact, and rarely shows empathy or compassion towards other human beings.

  2. Communication - Most kids on the spectrum has delayed speech or non verbal (40% of autistic kids are non verbal), this can be an early sign for you to identify who has autism. Kids with autism has trouble with speech and communication and they find it hard to express what they need also they find it hard to understand what you are talking to them. This can be because they find it hard to focus on you as they are mostly distracted by their surroundings.

  3. Behaviours and Interest - Behaviours and interest of autistic people can differ from person to person. Most children or grownups with Autism have repetitive movements with objects, repeated body movements such as rocking and hand flapping.

These are few of the characteristics of autism
  • Difficulty with verbal communication, including problems using and understanding language
  • Inability to participate in a conversation, even when the child has the ability to speak
  • Difficulty with non-verbal communication, such as gestures and facial expressions
  • Difficulty with social interaction, including relating to people and to his or her surroundings
  • Difficulty making friends and preferring to play alone
  • Unusual ways of playing with toys and other objects, such as only lining them up a certain way
  • Difficulty adjusting to changes in routine or familiar surroundings, or an unreasonable insistence on following routines in detail
  • Repetitive body movements, or patterns of behavior, such as hand flapping, spinning, and head banging
  • Preoccupation with unusual objects or parts of objects
However, autism is a spectrum disorder, therefore, children/people with autism behave very uniquely and challenges they go via differs from person to person. furthermore, the severity of the autism may change from time to time.

Autism can be a problem if it's not identified at child's early ages, autism can be identified within 18 months from child birth or even earlier. Infants with autism have no big smiles or other warm, joyful expressions by six months or later and no no back-and forth gestures such as pointing,showing reaching or waving by 12 months. Some kids with autism has no speech, babbling or social skills at any age. These are very few early signs of autism, if you see these red flags, its better not delay in asking your pediatrician or family doctor for an evaluation.

It's always good to identify autism at very early age so you can get the necessary help, with communication, language development, emotional skills and education.  Autism kid's will have a hard time dealing with social interaction and traditional approaches of learning, however, they can be very smart, knowledgable and gifted children. If they were given the right set of tools for their learning, and if educators can help them  understand how they can learn, they can do wonders.

Autistic Children are gifted and special, they have a really good focus on things and they see what most people miss. Due to this they have incredible skills in areas of mathematics arts music and many more. They see the world in a different manner and can help improve the world greatly.  Here are few of the famous autistic people.

Albert Einstein - Very intelligent physician   with many inventions
Amadeus Mozart - Talented musician
Sir Isaac Newton - Scientist with many inventions
Charles Darwin - Naturalist and geologist
Thomas Jefferson - President of United States
Michelangelo - Artist

As mention above, autistic people have un imaginable talents, and they make our world a better place.

The ugly part of autism is not the autistic people, its the society and how they look at autistic people. Due to lack of social skills, there are many instances autistic children get bullied and misunderstood. And most of them cannot understand sarcasm or phrasal words,  and they only understand the literal meanings of words. Their behaviour, and how they perceive things are different compared to majority of people,  due to that society tend to make autistic people feel less important or weird. According to Centres for Disease Control and Prevention, 1 in 68 people have autism. This means there is a large population of autistic people in the world today, if we can be more patient and understanding when dealing with them, we can make a better world for them as well as us.

Wednesday, August 31, 2016

Social Cognitive Approaches to Learning

My second theory which I am going to discuss on education psychology and how it can be applied when in teaching is social cognitive approaches to Learning. This mainly focuses on how learning happen via observations. The social learning theory was proposed by Albert Bandura with his Bobo doll experiment where he demonstrated that children learn and imitate behaviours they have observed in other people. And this theory can be used in educational psychology where you can influence children and improve their learning and development via observation. In my earlier post I spoke about how behavioural theories of learning was the result of association formed by conditioning, reinforcement and punishment. In this section I would like to discuss about social learning theory where learning can also occur simply by observing the actions of others and how this can be used on classroom activities to educate children.

Social Cognitive Theory 

Social cognitive theory explains that social and cognitive factors as well as behaviour plays an important learn in learning. And this plays a major role in schools and educational environments. Mostly because cognitive factors involved students brain development and success in their education and social factors include student’s observing their teachers and their behaviour. 

In this example we will look at how Bandura’s social cognitive theory can be applied in a classroom environment to achieve success 

  1. Cognition influences behaviour ­ At school a student name Alex develop strategies to solve a maths problem by thinking logically about how to solve the problem.
  2. Behaviour influences cognition ­ Alex working on the Math problem has led to her achieve good grades. And this will lead to self satisfaction which leads to cognition. 
  3. Environment influences Behaviour ­ Alex will enroll on higher maths program where it gives tips on solving problems efficiently and this will improve Alex’s maths skills.
  4. Behaviour influences environment ­ The higher math class succeed and many student in Alex’s class join that same program so that they will get tips to succeed in maths. 
  5. Cognition influences environment ­ The teachers and principals feel the need and expectations to have the higher maths program.
  6. Environment influence cognition ­ school establish a resources center where students can have books on tips on higher mathematics to improve their maths skills. 
Bandura further discuss self efficacy also known as confident in doing something is also very important when it comes to social cognitive theory, as even if the students have all the resources and models students might not get motivated to observe or pay attention/study hard if he/she does not have confident in learning 

Observational Learning 

There are three main concepts when it comes to observational learning or social learning and I will discuss each of these concepts from a teacher’s point of view and focus more on educational environment. 1) Students can learn from observation, 2) Student’s internal mental states matter when it comes to observational learning, 3) Just because a student learn some behaviour it does not mean he/she will change his behaviour. 

1. Students can learn via observation 

Observation learning is the learning that involves acquiring skills, strategies and beliefs by looking at others. And observation learning happen at classrooms by student’s observing models. There are three differant types of models that can influence observational learning 

 a) A live model ­ This can be a teacher or another peer student at a classroom who is an actual individual demonstrating or acting out the behaviour 
 b) Verbal instruction model ­ This can be a verbal instructor, a lecturer or announcer who make announcement at classrooms verbally who does not have to present while giving it. 
 c) A symbolic Model­ This can be a real or fictional character displaying the behaviour in books or documentary videos for example characters from history books or scientist on TV programs when it comes to educational environments 

2. Mental states are important to learning 

When it comes to observational learning mental state of the student is also very important. if the student is not confident when it comes to learning he/she will not learn at all. Bandura mention this as intrinsic reinforcement. If a student want to do observational learning he should get internal reward such as pride/satisfaction or some sense of accomplishment when learning the observations. This emphasis on internal thoughts and cognition helps connect learning theories to cognitive developmental theories. 

3. Learning does not necessarily leads to a change in behaviour 

When it comes to observational learning unlike behavioural learning learning does not lead to permanent change in behaviour, it can only demonstrate new information can be learn without demonstrating new behaviours 

Bandura highlighted this theory using a modeling process, Modeling process highlight the factors that make a learning successful via observation. These factors are known as Attention, Retention, Reproduction and Motivation. 

In order for a student to learn he/she must pay attention. Anything that distracts their attention is going to have a negative effect on learning. Therefore, teachers as model must make sure that students are paying attention while teaching and make sure the lesson are interesting so that students will pay more attention observing the teacher as the model 

For student to observe and learn the student must have the ability to store information. Therefore teachers must ensure that students have the capacity to store what they learn when teaching and give enough breaks when modeling. 

Once the student have paid attention to the teacher or the model and further retained information. As teachers, you should make sure students actually perfom the behaviour. It can be a language class or any other observation, students must practice what they learn in order to improve their skills 

Finally, in order for observational learning to be successful, student must be motivated to pay attention, retain and reproduce. If the students are not motivated enough he/she will not learn properly.Reinforcement and punishment play an important role in motivation. While experiencing these motivators can be highly effective, so can observing other experience some type of reinforcement or punishment. For example, if you see another student rewarded with extra credit for being to class on time, you might start to show up a few minutes early each day. 

How do you use observational Learning in your Classroom?

Examples of Social Learning at classroom 

Even Though most of the observational learning is not done on purpose, most children learn by observing their teachers specially when it comes to kids who are at kindergarten and preschool. Therefore, its always important that teachers become good role models for their students. These are some of the outcomes in observational learning. 
  1. Students learning how to solve maths problems by looking at their teacher solving the maths problem and they learn to solve similar maths problems by using the same theory. 
  2. Student’s learn how to speak a foreign language by listening to their teacher. Therefore, the student will get the teacher’s accent. 
  3. Students learn how write by looking at how the teacher writes 
  4. Student can learn art and craft work by looking at their art teach and learn hand work 
  5. Student learn how to keep their desks clean and tidy by looking at their teachers desks 

These are few examples of social learning that happen at classroom, however, teachers can use this theory to educate children. 

● For example teachers can invite popular athlete to come to class room and give their student a talk, so the student get influenced by the athlete and get motivated and learn skills from the athlete further that athlete can be a role model for students who are into athletics. 

● Another example would be teachers can influence weak students (students who are behind their schedule) by making them associate with brighter peers, so that weaker students can observe and learn from their peers. 

● Albert Bandura’s social learning theory can be applied in classroom with the use of technology. By doing educational computer programs and educational documentaries children learn and they change their behaviour by observing the characters on movies and educational games. A good example of this can be is the popular video game “Dora the explorer” or “Sesame Streat”, most preschoolers learn language and other soft skills by watching how dora plays and they learn via observations 

These are few techniques that can be used at classroom, with the use of observational learning. However, its important that the teachers make sure the models for these observations are the right and very influential. 

Advantages of Observational Learning 

There are many advantages of observational learning as most children learn their basics at their very early ages via observation. These are the list of advantages you can gain at classroom via observational learning. The main advantage of observational learning is it lacks objectives most of the time and it is not traditional formal learning structure and students learn unknowingly with the uses of practical and real life experience and gain life skills at very young age. 

● Learning makes fun and can learn things without effort.
     ○ Since observational learning is not like traditional learning student learn things more naturally and it does not take an effort to learn them. It further creates a flexible learning environment if applied in classrooms and unlike behavioural approaches children are able to explore and gain creativity. As a results children learn observation skills, problem solving skills and creativity. 

● Encourages social interactions
    ○ Since observational learning is about observing others and learning children learn language and communication skills which are building blocks of social interaction. Further, observation learning encourage pretend play which improve development skills in early childhood development. Further it will build character and self esteem so that they can interact with the society with diverse activities. 

● Improve their behaviour and quality of life
   ○ Teachers can discipline their students via observation learning. Specially if there are students with behavioural issues, teachers can improve their behaviour by showing models that students appreciate and they will eventually fix their behaviour by looking at the models they adore (this can be fictional or real life models). 

● Improve memory and brain development
   ○ Observation learning practices retention and retention improves memory and cognition. When students learn from their environment by retaining the information they observe it will enhance their memory capacities. 

● Expands and exchange knowledge
    ○ Observational learning helps students expand their knowledge by observing different roles. For example if a classroom supports observational learning, the children learn via various models including their peers. This helps them gain new information and also exchange new information via their peers. Further, if technology is used on observational learning, students can gain knowledge at international level. 

Disadvantages of Observational Learning 

Even though, observational learning has their benefits there are some drawbacks with observational learning at classroom when it is done poorly. 

● Poor Role Models Demonstrate Poor Behavior
    ○ If the role models gives bad examples like teachers showing aggression in front of children or if teachers show war related documentaries children learn aggression via observation (just like bandura’s bobo doll experiment). Therefore as teacher’s they must be very careful when behaving in front of students, as they tend to learn a lot from teachers. 

● Undesirable Models May Reinforce Behavior
    ○ When students work with their peers they can learn bad behaviours from their peers and learn bad behaviours as socially acceptable. This can happen via technology as well as the staff at school. Therefore, bad behaviour and bad practices seems very desirable to children and influence them in a negative way. 

● Evidence of Learning is Not Always Visible
    ○ In observational learning students learn by observation retaining and reproduction. However, the outcomes of learning is not always visible. It can be good or bad behaviour, even if the children learn something it will not always show until it triggers. 

● Observational Learning Requires Motivation 
   ○ Unlike behavioural tools observational learning requires motivation within themselves. If students are not motivated to reproduce what they learn they will stop at attention model itself and for some students if the role models are not powerful for them, Further for students who have various disabilities like ADHD or Autism, observational learning will not be a good tool to use 

In conclusion, observational learning can be a powerful tool for educating children. Most children learn from observation therefore, its important for teachers to make sure they are exposed to powerful role models who can influence students in a positive manner. Further teachers as educators must encourage collaborative learning and incentive and the supportive environment since learning happen via the environment. Further teacher must not miss use this observational tool and use it carefully since both good and bad can be observed by children and it can lead to socially unacceptable behaviours.

Tuesday, August 30, 2016

Behavioural approaches to Learning

Behavioural theories of educational psychology focus on learning via behavioural changes, and as a person learn, he/she alter the way they perceive their environment. Which helps them process new information. Behavioural studies focus on two main areas when it comes to education psychology. 1. Classical conditioning founded by John B Watson, and the 2. Operant conditioning founded by B.F Skinner. Classical conditioning concepts are not widely used in classroom environments therefore, I will be focusing more on operant conditioning concepts and how it can be used for educational purposes to motivate students and excel their capabilities to the maximum capacity.

Operant Conditioning used as a teaching technique

Discipline is the key to success of child’s development and learning and one of the most popular approach of disciplining a child by the use of Operant conditioning. Operant conditioning was invented by B. F skinner which is also known as instrumental learning. This is a method of learning via reward and punishment methodologies. Operant condition can be used to reward the good behaviour by reinforcement and minimize bad behaviour by punishments. In operant conditioning if an action is followed by a reinforcement (either positive or negative) it’s mostly likely to occur again in the future. For example if a student in the class clean the classroom on time and you have given him a gold star (a token as a positive reinforcement) the student will likely to clean the classroom again in order to get praised from the teacher. Conversely if an action has bad consequences and result in punishments this has a likelihood of weaken the action. For example if a student does not do his/her homework and if you give them extra hours of school (positive punishment) it;s more likely that student will do his/her homework on time next time in order to avoid punishment. This way you can motivate your students for better behaviour in classrooms using operant conditioning.

Here are some behaviours which can be improved by re enforcement 

Behavior Consequences Future Behavior
Positive Reinforcement
Student ask a good questions
Teacher Praise the student
Students will continue asking more questions
Student does homework on time
Teacher gives a gold star
Student will always do the home work on time
Negative Reinforcement
When the student write a good report
Teacher gives less homework
Student will continue writing good reports
When the student come to the classroom on time
Teacher finish the lesson early
Students will continue to come to class on time

Here are some students behaviours that can be decreased by punishments

Behavior Consequences Future Behavior
Positive Punishment
Student interrupts at class
Teacher yells at the student
Student will minimize interruptions
Student gives a bad report
Teacher gives a black star
student will try to do a better report next time
Negative punishment
When student is late for class
Teacher take his play time for classroom work
Student will try to come to class on time
When student text during the class
Teacher takes away his mobile phone
Student will not use his mobile at class

Those are some of the common uses of operant conditioning at classroom, however, when applying theory of B.F skinner its important to consider the age level of the student when rewarding/punishment student’s behaviour. And there are various different types of reinforcers/punishments can be used increase or decreased the behaviour according to the desired behaviour of the teacher in a classroom setting. They can be appear in different forms such as 1. Consumable (ie Candy) 2. Social (ie praise/yelling) 3. Activity (More time on the playground) 4, Exchangeables (tokens/stars) and 5. Tangible (getting the best seat). Among these components most educational valuable and relevant can activity as they can be done with educational value such as doing an educational game or watching an educational video. However, no matter what the method is, its important to give the consequences right after the behaviour.

There are various types of reinforcement schedules can be used at classrooms, namely fixed ratio, fixed interval, variable ratio and variable interval. In an educational setting the two variable schedules are the best to maintain the desired behaviour as they are very unpredictable. For example if a students were given the chance to watch an educational movie after handing their assignments on time, they would be more motivated to do it if the outcome is always not the same (variable ratio) or the time during which they hand over the assignment and the reward has unpredictable gaps (variable interval).

Advantages of using operant conditioning in classroom
  • When a child is rewarded for his/her good behaviour the child will get motivated and keep on doing that behaviour and he/she will eventually absorbed good behaviour 
  • When the child is punished for his bad behaviour he/she will stop doing it. 
  • It will be effective when it comes to shaping and discipline preschool and kindergarten children 
  • Internal reinforcement benefits students with self satisfaction, when doing a math problem right will motivate them to do more and more maths and eventually the student will be a pro at it (provide students an incentive to learn) 
  • Deliberate use by teachers provides students with the ability to respond to antecedents without fully realising it is influencing their behaviour. 
  • Can be easily used as a tool for kids with disabilities such as ADHD/Autism/Conduct disorder to discipline and get attention
Disadvantages of using operant conditioning in classrooms
  • It will decrease child’s creativity and to think from his own as he/she will be scared of punishment 
  • It will not work for for everyone, and some children might take punishment as a reinforcement (ie a student who does not get enough attention will do bad things to get attention from the teacher and will enjoy getting punished) 
  • The student can pretend to stop the behaviour just to get the reward or avoid the punishment. Once the reward is given they could go back to bad behaviour 
  • If rewards or punishments are misused it would give bad outcomes 
  • Operant conditioning does not take cognitive factors into account 

In conclusion operant conditioning is a very effective tool for teachers, specially when it comes to shaping the children for good behaviour and also to help them learn. This can also be used for kids with disabilities such as autism or ADHD to discipline them in order to get their attention. However, it must be used cautiously and consistently. Since behaviour management will be different for different students, punishment and rewarding must be done at individual level at individual circumstances.

Technology For Education ..

For the next few years, I will be focusing more on technology for education and going to discuss how technology can play a major role in early childhood education. Also I will be talking about education psychology, technology for  children with special needs and a whole lot about Autism.
The main reason for this change is because, as educators/care givers/human beings, we need to be aware of  children with special needs and see the world from their point of view and always help them to achieve their best. For the next couple of years I will be researching more about educational platforms that can improve cognition, social and  communication, emotional intelligence and linguistic skills in special needs child. Also how they can learn how to learn and see how we can improve the traditional education system for the betterment of our children.

Wednesday, January 29, 2014

Real time log event analysis with WSO2 BAM(CEP features)

One of the major problems when it comes to managing/monitoring distributed systems is not being able to detect when your system is giving issues all of a sudden. Lets say you have like 100 servers and you need to detect when a fatal error appears in the system and you want to act right away. This is nearly impossible if you do not have proper monitoring tools.
WSO2 BAM with WSO2 CEP features has the perfect mechanism to monitor real time logs and alert it to relevant parties when an expectation/ suspicious error occurs.

In this sample I will be using WSO2 Appserver and WSO2 BAM in order to demonstrate the monitoring and alerting capabilities of WSO2 BAM 2.4.0.

  • WSO2 Appserver will be used to send log events to BAM.
  • WSO2 BAM will do all the monitoring and alerting when logs are captured.
Send Logs to BAM

To send logs all you need to is go to WSO2_AS_HOME/repository/conf/ and add LOGEVENT to the root logger. And start Appserver. (please make sure your BAM server is up and running before starting the Appserver)

To test if the logs are successfully sent to BAM, you can log in to cassandra explorer and see if there is a new column family created under EVENT_KS keyspace

ie log.AS.0.2013.1.12

Configuring WSO2 BAM for REAL TIME analytics

In this demo, I will be sending an email if an ERROR log occurs in WSO2 Appserver.  Since we will be using mail transport in BAM to send email alerts to recipients, we have to enable mail transport in BAM. To do that go to repository->conf->axis2->axis2-client.xml and add email configurations.

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
       <parameter name="mail.smtp.from"></parameter>
       <parameter name="mail.smtp.user">wso2esb.mail</parameter>
       <parameter name="mail.smtp.password">wso2mail</parameter>
       <parameter name=""></parameter>
       <parameter name="mail.smtp.port">587</parameter>
       <parameter name="mail.smtp.starttls.enable">true</parameter>
       <parameter name="mail.smtp.auth">true</parameter>

Here you can give your own email configurations. 

Restart/Start the BAM server.

Assuming the logs are getting published to BAM, lets see how we can capture these log events for real time analytics.

Step 1 - Creating Event Adapters

In order to do real time analytics we need to create an execution plan. For that we need two input adapters.

  1. Input adapter - to capture log events coming to BAM (in  this case it will be a wso2event).
  2. Output adapter - to send emails
To create adapters you need to login to BAM management console. Under configurations, there will be "Event Processor Configs" and add input event adapters and output event adapters as shown below.

Input Event adapter

Output Event Adapter

Step 1 - Creating Stream Definitions

Now that we have created event adapters, we need to create a stream definition to capture the LogEvent in order to do complex event processing. In the appserver log event, these are the attributes we have.

  • Meta Data
    • clientType {String}
  • Payload Data
    • tenantID  {String}
    • serverName {String}
    • appName  {String}
    • logTime  {Long}
    • priority {String}
    • message {String}
    • logger {String}
    • ip {String}
    • instance {String}
    • stacktrace {String}
To create the stream definition, go to main tab and under create stream definition you can create the log event stream as shown below.

Step 1 - Creating the Execution Plan

In the execution plan we will be specifying the input stream and writing a CEP Query (SQL Like Query)  for the event stream.

Go to Create Execution Plan, and give suitable name for the execution plan. Select the needed stream and give an alias. Click on import after selecting the stream. In our CEP Query we will analyze events and if an event has an error, we will send it to an output stream.


from LogEvents[priority == "ERROR"]
select message,stacktrace,serverName
insert into ExceptionStream

After creating the Query, we need to add the exported stream (which is the stream that we are sending Error logs) according to our CEP querry exported stream name should be ExceptionStream give the value of the exported stream name and select "Create Stream Definition" to create the ExceptionStream. This stream will be auto generated by looking at the CEP as shown below.

Once we create the Exception stream select the Exception stream as exported stream and create a new formatter. This formatter is used to specify the email body and email related information like the subject, to address ect.  Give the output mapping type as text so we can give the content of the email message body inline. 

Email Body

Error Occurred in {{serverName}} – {{message}}

In this body we are taking message, stacktrace and server name from the OutputStream (ExceptionStream) and adding a readable message for the email message body.

Add the event formatter and save the execution plan. Now we have successfully created the event trigger to monitory error logs for wso2 appserver. You can test this by invoking a service with an error.

If you want more in depth information on real time log event analytics you can follow the following screen cast for more details

Wednesday, January 15, 2014

[Screencast] Monitoring system logs with WSO2 Business Activity Monitor

This screencast explain how you can do your enterprise monitoring using BAM and CEP features.

Overview of the screencast

  * Send Log Events to BAM/CEP

  * Create analytics to analyse logs daily( can be scheduled accordingly)

  * Create gadgets with  log statistics (charts/tables)

  * Monitor logs real time with CEP (send alerts to relevant parties when an error log appears.)


Thursday, January 9, 2014

Eventing using WSO2 DSS - Send data to a JMS Queue for a given event trigger

If you want to trigger an event depend on an SQL related service call this is a great example on how you can do it using WSO2 Data Service Server.

In this sample I am going to explain how you can handle event triggers in WSO2 Data service server.  In WSO2 DSS, you have two types of event triggers.

1. Input event triggers - which trigger's an event looking at the request.
2. Output event triggers - which trigger's an event looking at the response.

For both of these trigger's you can specify an ex-path expression to trigger the event.

To demonstrate this functionality I  am going to write a small data service which insert Student information. And every time an insertion happen, primary key of the inserted record will be send to a JMS Queue.


In order to try out this sample you need to have
  -> WSO2 Data Services Server Downloaded
  -> You need to have a database of your choice
  -> Add related drivers to DSS_HOME/repository/component/lib folder
  -> ActiveMQ downloaded and started

Step 1 - Enable JMS senders in WSO2 DSS.

In order to send JMS messages from data services, you need to enable the JMS sender in data services server.
To enable JMSSender -> Go to DSS_HOME/repository/conf/axis2/axis2.xml and un-comment the following line.

<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>

and then start the data services instance.

Step 2 - Create data Service.

If you are new on creating data services, please refer the following post on how to create a data service using WSO2 Data Service Server.

I have a small table called Student. Lets create a simple data service for the table student.

describe Student;
| Field   | Type        | Null | Key | Default | Extra          |
| sid     | int(11)     | NO   | PRI | NULL    | auto_increment |
| name    | varchar(90) | YES  |     | NULL    |                |
| address | varchar(75) | YES  |     | NULL    |                |
| country | varchar(75) | YES  |     | NULL    |                |
| phone   | varchar(20) | YES  |     | NULL    |                |
| major   | varchar(50) | YES  |     | NULL    |                |
| gpa     | float       | YES  |     | NULL    |                |
| tutorid | int(11)     | YES  |     | NULL    |                |
8 rows in set (0.00 sec)

Log in to DSS management console -> Create New Data Service. Give the data service name appropriately and click on next.

Click on Add Data Source and give database configuration appropriately and click on next.

Next section we will discuss how we can write a data service Query which can invoke a trigger according to the query result.

In this Query my SQL is simple insert

INSERT INTO Student(name,address,country,phone,major,gpa,tutorid) VALUES(:name,:address,:country,:phone,:major,:gpa,:tutorid)

Click on "Generate Input Mappings", and this will generate the input mappings for the input parameters.

Since we need a response back (ideally it will be the primary key of the newly inserted record) we can click  Return generated key which will auto generate the response.

To add the event trigger, scroll down a little bit. Under Events, click on Manage Events. There, we give the eventing configurations.

Event ID - student_addition_trigger

Xpath - //*[local-name()='ID' and namespace-uri()='']>0

Target Topic - student_insertion_topic

Event Sink URL ( JMS URL according to your activeMQ)

Go to Main Configuration and add the Output trigger as shown below.

Now we have done with our Query Section. Click on Save to save the Query and Click next to add the  operation.
Add New Opperation ->
Operation Name* - InsertStudent
Query ID* - insertQ

Save and finish.

Now we can test this functionality by using the try it function provided by Data Service Server

My Request

   <body> <p:InsertStudent xmlns:p="">

My Response

   <GeneratedKeys xmlns=""> <Entry>

If you go to your active MQ console, You would see number of pending messages as shown below. You can go inside your Queue and explore more!!!!

Saturday, October 12, 2013

How to Receive Emails to WSO2 ESB

In one of my previous blogs, I have explained how we can send emails using WSO2 ESB, in this post I am going to explain how we receive emails to WSO2 ESB, so that you can collect data from in coming emails and do some processing and send them to data storage or any other end point.

Before we start ESB server, you need to enable mail transport listeners in ESB. In order to do that you need to go to WSO2_ESB_HOME/repository/conf/axis2/axis2.xml and un comment the following.
<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener" />

Then start the server.

Creating the proxy service

To create the proxy, go to add -> Proxy service -> Custom Proxy service. There we'l give the name as MyMailProzy.
And you need to give set of service parameters as listed below.

 <parameter name="transport.PollInterval">5</parameter>

   <parameter name=""></parameter>
   <parameter name="mail.pop3.password">wso2mail</parameter>
   <parameter name="mail.pop3.user">wso2esb.mail</parameter>
   <parameter name="mail.pop3.socketFactory.port">995</parameter>
   <parameter name="transport.mail.ContentType">text/plain</parameter>
   <parameter name="mail.pop3.port">995</parameter>
   <parameter name="mail.pop3.socketFactory.fallback">false</parameter>
   <parameter name="transport.mail.Address"></parameter>
   <parameter name="transport.mail.Protocol">pop3</parameter>
   <parameter name="mail.pop3.socketFactory.class"></parameter>

And also under Transport Settings you need to enable mailto transport as shown in the below diagram.

Click on next and we will configure the in sequence.

There we will log the sender's email address by getting the sender email address to a property from the transports (get-property('transport', 'From')) and then using log mediator to log it

<inSequence xmlns="">

   <property name="senderAddress" expression="get-property('transport', 'From')" scope="default" type="STRING"/>
   <log level="full">
      <property name="Sender Address" expression="get-property('senderAddress')"/>

Click on next to configure the out sequence.

In the out sequence we will be having a simple send mediator which will send the response back to the client.

The full ESB Configuration

<?xml version="1.0" encoding="UTF-8"?>

<proxy xmlns=""
         <property name="senderAddress" expression="get-property('transport', 'From')"/>
         <log level="full">
            <property name="Sender Address" expression="get-property('senderAddress')"/>
   <parameter name=""></parameter>
   <parameter name="transport.PollInterval">5</parameter>
   <parameter name="mail.pop3.password">wso2mail</parameter>
   <parameter name="transport.mail.ContentType">text/plain</parameter>
   <parameter name="mail.pop3.socketFactory.port">995</parameter>
   <parameter name="mail.pop3.user">wso2esb.mail</parameter>
   <parameter name="mail.pop3.socketFactory.fallback">false</parameter>
   <parameter name="mail.pop3.port">995</parameter>
   <parameter name="transport.mail.Address"></parameter>
   <parameter name="mail.pop3.socketFactory.class"></parameter>
   <parameter name="transport.mail.Protocol">pop3</parameter>

Sending the EMAIL

I have used my gmail to send the email to ESB, my to address will be, and you can customize your own subject, and the message body.

Once we send the email, the email will be received to ESB, and you will see the following logs

[2013-10-13 09:06:45,038]  INFO - LogMediator To: , From:, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: <>, Direction: request, Sender Address = Amani Soysa <>, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv=""><soapenv:Body><text xmlns="">--001a11c233ea18b53d04e8970f15&#xd; Content-Type: text/plain; charset=ISO-8859-1&#xd; &#xd; Sending emails to  WSO2 Enterprise Service Bus!!!!&#xd; &#xd; --001a11c233ea18b53d04e8970f15&#xd; Content-Type: text/html; charset=ISO-8859-1&#xd; Content-Transfer-Encoding: quoted-printable&#xd; &#xd; &lt;div dir=3D"ltr">Sending emails to=A0&lt;span style=3D"color:rgb(68,68,68);fon=&#xd; t-family:arial,sans-serif;line-height:16px" >=A0&lt;/span>&lt;span style=3D"font-w=&#xd;eight:bold;color:rgb(68,68,68);font-family:arial,sans-serif;line-height:16p=&#xd;x" >WSO2 Enterprise Service Bus!!!!&lt;/span>=A0&lt;/div>&#xd;&#xd; --001a11c233ea18b53d04e8970f15--&#xd; </text></soapenv:Body></soapenv:Envelope>