[erlang-questions] How to do this in Erlang -- any suggestions ?

黃耀賢 (Yau-Hsien Huang) <>
Sun Jun 12 17:38:09 CEST 2011


Hi, Banibrata.

Before my opinion, could you tell me where, from which books, did you know
spot patterns? A request for reading materials suggestion.

Back to this topic,

On Sun, Jun 12, 2011 at 10:51 PM, Banibrata Dutta <
> wrote:

> Prematurely sent.
>
>
> On Sun, Jun 12, 2011 at 7:59 PM, Banibrata Dutta <
> > wrote:
>
>>
>> What would be a good way to correlate asynchronous events, spot patterns
>> over a sliding window (s.a. of no. of events elapsed or time elapsed), with
>> millions of events occurring simultaneously, using Erlang ?
>>
>> The set of possible events is known, and any unknown event is just flagged
>> as 'unknown' (so all unknowns are similar). The set of possible event
>> patterns can be enumerated, but is possibly quite a large set of patterns.
>>
>
> Was wondering as to what could be the approach taken to implement such a
> thing in pure Erlang. My initial thoughts were along the line of maintaining
> FSMs per event source, but with so many events and so many possible/valid
> patterns, the thing seems kind of unwieldy. Also, I'd like a non-programmer
> to be able to define new events and valid event patterns.
>
> I believe 'Complex Event Processing' is quite likely to be the standard
> approach for such things, as I've found from some posts, and solutions exist
> in Java world for same, but both as an academic exercise (for the fun of
> learning) and for a potentially simpler + better solution, would like to try
> doing this is Erlang.
>
> --
> regards,
> Banibrata
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>

The atomic message-sending command in Erlang is just to send things and
done.
"Send and forget it." Joe Armstrong and Erlang book writers said the word.

A strip can be seen in many Erlang programs.

    Pid ! {self(), hello, world},
    receive
        {Pid1, Pattern1} ->
            ....
    end,

a 'send' followed by a 'receive'. It seems synchronous.

There can be some asynchronous approach. For example, a listener is started
and
its PID is recorded as 'Pid1'. Every time it sends messages, the strip of
sending can
be

    Pid ! {Pid1, hello, world},

sending a message but no 'receive' instruction following. The PID of the
listener is
within the message, and it's treated as a callback endpoint by remote
process.
This is a general asynchronous model.

On concepts of event-processing, in my opinion, it's similar to the
Object-Oriented
concepts. Some may want to define as many as possible, near all available,
events/objects when planning and designing a system. However, most of these
efforts tend to be in vain. Better approach can be to just list
events/objects those
in need and use their common patterns.

/yhh

-- 

Best Regards.

--- Y-H. H.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110612/0bb58cbe/attachment.html>


More information about the erlang-questions mailing list