You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mario Giammarco <mg...@gmail.com> on 2021/09/14 08:08:02 UTC

Is camel right for my project with Asterisk?

Hi,
I have used successfully Camel in the past.
But again I want to use it in a message passing project to see if:
- I can do with less lines of code comparing to using only Java
- the readability of the code is improved (so I want to use all Camel features and not write custom beans to do all the work)

Basically the project is this: I want to do a Camel application that receives Asterisk AMI messages from clients, modify them, and send them to several Asterisk servers depending on enriched message content.

Actually I have these problems:

- Camel has an Asterisk component but it seems unused/unsupported/proof of concept

- The asterisk component is client only, so I need to create a socket server and parse messages. Messages are like this:
key: value \n
key: value \n
\n\n
  I hoped I can parse a string message like this and convert to a Camel message (java map) with camel marshallers but I cannot find the right one. Or probably I need to do an aggregator until double newline but again it seems too complex to me.

- I need to keep a state (for example: message come from an authenticated client) and again I do not see an easy example to follow.

So I am asking your help and your suggestions!

Thanks in advance for any help.
Mario 


Re: Is camel right for my project with Asterisk?

Posted by Andrea Cosentino <an...@gmail.com>.
You have a reply from Claus Ibsen.

Il mar 21 set 2021, 08:17 Mario Giammarco <mg...@gmail.com> ha scritto:

> Wow still no replies.
> Can at least someone tell me if Asterisk endpoint is supported?
>
> On 2021/09/16 18:27:46, Mario Giammarco <mg...@gmail.com> wrote:
> > Wow, no replies.
> > Probably I have not gave a simple enough explanation.
> > Let's try to start to a simpler thing.
> > First problem: convert this file type to json using camel:
> > key1: value1\n
> > key2: value2\n
> > \n\n
> >
> > Can you give me some initial help?
> > Thanks,
> > Mario
> >
> > On 2021/09/14 08:08:02, Mario Giammarco <mg...@gmail.com> wrote:
> > > Hi,
> > > I have used successfully Camel in the past.
> > > But again I want to use it in a message passing project to see if:
> > > - I can do with less lines of code comparing to using only Java
> > > - the readability of the code is improved (so I want to use all Camel
> features and not write custom beans to do all the work)
> > >
> > > Basically the project is this: I want to do a Camel application that
> receives Asterisk AMI messages from clients, modify them, and send them to
> several Asterisk servers depending on enriched message content.
> > >
> > > Actually I have these problems:
> > >
> > > - Camel has an Asterisk component but it seems
> unused/unsupported/proof of concept
> > >
> > > - The asterisk component is client only, so I need to create a socket
> server and parse messages. Messages are like this:
> > > key: value \n
> > > key: value \n
> > > \n\n
> > >   I hoped I can parse a string message like this and convert to a
> Camel message (java map) with camel marshallers but I cannot find the right
> one. Or probably I need to do an aggregator until double newline but again
> it seems too complex to me.
> > >
> > > - I need to keep a state (for example: message come from an
> authenticated client) and again I do not see an easy example to follow.
> > >
> > > So I am asking your help and your suggestions!
> > >
> > > Thanks in advance for any help.
> > > Mario
> > >
> > >
> >
>

Re: Is camel right for my project with Asterisk?

Posted by Mario Giammarco <mg...@gmail.com>.
Wow still no replies.
Can at least someone tell me if Asterisk endpoint is supported?

On 2021/09/16 18:27:46, Mario Giammarco <mg...@gmail.com> wrote: 
> Wow, no replies.
> Probably I have not gave a simple enough explanation.
> Let's try to start to a simpler thing.
> First problem: convert this file type to json using camel:
> key1: value1\n
> key2: value2\n
> \n\n
> 
> Can you give me some initial help?
> Thanks,
> Mario
> 
> On 2021/09/14 08:08:02, Mario Giammarco <mg...@gmail.com> wrote: 
> > Hi,
> > I have used successfully Camel in the past.
> > But again I want to use it in a message passing project to see if:
> > - I can do with less lines of code comparing to using only Java
> > - the readability of the code is improved (so I want to use all Camel features and not write custom beans to do all the work)
> > 
> > Basically the project is this: I want to do a Camel application that receives Asterisk AMI messages from clients, modify them, and send them to several Asterisk servers depending on enriched message content.
> > 
> > Actually I have these problems:
> > 
> > - Camel has an Asterisk component but it seems unused/unsupported/proof of concept
> > 
> > - The asterisk component is client only, so I need to create a socket server and parse messages. Messages are like this:
> > key: value \n
> > key: value \n
> > \n\n
> >   I hoped I can parse a string message like this and convert to a Camel message (java map) with camel marshallers but I cannot find the right one. Or probably I need to do an aggregator until double newline but again it seems too complex to me.
> > 
> > - I need to keep a state (for example: message come from an authenticated client) and again I do not see an easy example to follow.
> > 
> > So I am asking your help and your suggestions!
> > 
> > Thanks in advance for any help.
> > Mario 
> > 
> > 
> 

Re: Is camel right for my project with Asterisk?

Posted by Mario Giammarco <mg...@gmail.com>.
Wow, no replies.
Probably I have not gave a simple enough explanation.
Let's try to start to a simpler thing.
First problem: convert this file type to json using camel:
key1: value1\n
key2: value2\n
\n\n

Can you give me some initial help?
Thanks,
Mario

On 2021/09/14 08:08:02, Mario Giammarco <mg...@gmail.com> wrote: 
> Hi,
> I have used successfully Camel in the past.
> But again I want to use it in a message passing project to see if:
> - I can do with less lines of code comparing to using only Java
> - the readability of the code is improved (so I want to use all Camel features and not write custom beans to do all the work)
> 
> Basically the project is this: I want to do a Camel application that receives Asterisk AMI messages from clients, modify them, and send them to several Asterisk servers depending on enriched message content.
> 
> Actually I have these problems:
> 
> - Camel has an Asterisk component but it seems unused/unsupported/proof of concept
> 
> - The asterisk component is client only, so I need to create a socket server and parse messages. Messages are like this:
> key: value \n
> key: value \n
> \n\n
>   I hoped I can parse a string message like this and convert to a Camel message (java map) with camel marshallers but I cannot find the right one. Or probably I need to do an aggregator until double newline but again it seems too complex to me.
> 
> - I need to keep a state (for example: message come from an authenticated client) and again I do not see an easy example to follow.
> 
> So I am asking your help and your suggestions!
> 
> Thanks in advance for any help.
> Mario 
> 
> 

Re: Is camel right for my project with Asterisk?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

For TCP networking then you can use netty as a server and write a
custom codec to plugin to any kind of custom format.

In this codec, you can parse it accordingly to your format. It seems
like \n\n is the end of record indicator.
See Netty project for how to write custom codec.

And there is a simple custom codec example here
https://github.com/camelinaction/camelinaction2/tree/master/chapter6/netty/src/test/java/camelinaction

And for the asterix component, then we sure love contributions. But it
may be an effort to implement it as server part,
if there is not something more easy to reuse. Otherwise there is as
mention Netty.


On Tue, Sep 14, 2021 at 10:08 AM Mario Giammarco <mg...@gmail.com> wrote:
>
> Hi,
> I have used successfully Camel in the past.
> But again I want to use it in a message passing project to see if:
> - I can do with less lines of code comparing to using only Java
> - the readability of the code is improved (so I want to use all Camel features and not write custom beans to do all the work)
>
> Basically the project is this: I want to do a Camel application that receives Asterisk AMI messages from clients, modify them, and send them to several Asterisk servers depending on enriched message content.
>
> Actually I have these problems:
>
> - Camel has an Asterisk component but it seems unused/unsupported/proof of concept
>
> - The asterisk component is client only, so I need to create a socket server and parse messages. Messages are like this:
> key: value \n
> key: value \n
> \n\n
>   I hoped I can parse a string message like this and convert to a Camel message (java map) with camel marshallers but I cannot find the right one. Or probably I need to do an aggregator until double newline but again it seems too complex to me.
>
> - I need to keep a state (for example: message come from an authenticated client) and again I do not see an easy example to follow.
>
> So I am asking your help and your suggestions!
>
> Thanks in advance for any help.
> Mario
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2