You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by gardion1 <jo...@gmail.com> on 2009/10/05 22:55:31 UTC
writing smpp messages to a database
Hello all,
I'm fairly new to service mix but I have installed it and followed the
tutorials 1-3. Seeing as service mix is new to me I thought I would ask
what the best approach would be for solving a problem
I am working on a service that would take messages received from smpp and
write them to a mysql database. (the sms message that comes in will contain
xml like <mymessage>hello<mymessage>)
what jbi components would be the best to use in order to do that? I know
about the servicemix-smpp and I have managed to set it up to receive
messages from an smsc emulator. However, what other components would I need
to talk to mysql? I'm assuming I would use JDBC to do that.
I will also be doing the reverse and having the mysql database send an xml
message that should be sent out by smpp.
Any thoughts?
Thank you,
Joel
--
View this message in context: http://www.nabble.com/writing-smpp-messages-to-a-database-tp25757012p25757012.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: writing smpp messages to a database
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Yes, I saw your message concerning camel route.
You can use a servicemix-bean endpoint in the same way as the database
level. In the bean you simply make:
NormalizedMessage message = exchange.getMessage("in");
Source content = message.getContent();
SourceTransformer transformer = new SourceTransformer();
Document document = transformer.toDOMElement(content);
System.out.println(document);
I check your camel issue on the other thread.
Regards
JB
gardion1 wrote:
> Jean-Baptiste,
>
> Thank you for your help again. I will try this method out. In the meantime
> I'm trying to get smpp to send messages to any other endpoint just so I can
> see that it is working. However, I can't seem to send smpp messages to file
> or log or anything at the moment. The smpp component does receive the
> messages and I have varified that. Once I get that step done I will try
> your database code.
>
> Thanks,
>
>
>
> Jean-Baptiste Onofré wrote:
>> Hi Joel,
>>
>> for now, the servicemix-jdbc component is not yet ready.
>>
>> However, you can use a servicemix-bean to store on the database. I have
>> written a sample to show how to do:
>> http://svn.apache.org/repos/asf/servicemix/smx3/trunk/samples/database-bean/
>>
>> So, to summarize, you need two SUs:
>>
>> 1/ SMPP consumer SU with the following xbean.xml:
>> <smpp:consumer service="test:service"
>> endpoint="endpoint"
>> targetService="test:service"
>> targetEndpoint="database"
>> host="smpp.example.com"
>> port="2700"
>> systemId="user"
>> password="passwd"/>
>> This SMPP consumer endpoint will receive messages from the SMPP server
>> and route it to the database endpoint.
>> 2/ Bean SU with the following xbean.xml:
>>
>> <bean:endpoint service="test:service" endpoint="database"
>> bean="#databaseBean"/>
>> <bean id="databaseBean" class="com.example.DatabaseBean"/>
>> </beans>
>>
>> The DatabaseBean takes the incoming message (as formatted by the SMPP
>> endpoint), parse it to extract data and store into a database.
>> I let you code the DatabaseBean using the sample.
>>
>> Regards
>> JB
>>
>> gardion1 wrote:
>>> Hello all,
>>>
>>> I'm fairly new to service mix but I have installed it and followed the
>>> tutorials 1-3. Seeing as service mix is new to me I thought I would ask
>>> what the best approach would be for solving a problem
>>>
>>> I am working on a service that would take messages received from smpp and
>>> write them to a mysql database. (the sms message that comes in will
>>> contain
>>> xml like <mymessage>hello<mymessage>)
>>>
>>> what jbi components would be the best to use in order to do that? I know
>>> about the servicemix-smpp and I have managed to set it up to receive
>>> messages from an smsc emulator. However, what other components would I
>>> need
>>> to talk to mysql? I'm assuming I would use JDBC to do that.
>>>
>>> I will also be doing the reverse and having the mysql database send an
>>> xml
>>> message that should be sent out by smpp.
>>>
>>> Any thoughts?
>>>
>>> Thank you,
>>>
>>> Joel
>>>
>>
>
Re: writing smpp messages to a database
Posted by gardion1 <jo...@gmail.com>.
Jean-Baptiste,
Thank you for your help again. I will try this method out. In the meantime
I'm trying to get smpp to send messages to any other endpoint just so I can
see that it is working. However, I can't seem to send smpp messages to file
or log or anything at the moment. The smpp component does receive the
messages and I have varified that. Once I get that step done I will try
your database code.
Thanks,
Jean-Baptiste Onofré wrote:
>
> Hi Joel,
>
> for now, the servicemix-jdbc component is not yet ready.
>
> However, you can use a servicemix-bean to store on the database. I have
> written a sample to show how to do:
> http://svn.apache.org/repos/asf/servicemix/smx3/trunk/samples/database-bean/
>
> So, to summarize, you need two SUs:
>
> 1/ SMPP consumer SU with the following xbean.xml:
> <smpp:consumer service="test:service"
> endpoint="endpoint"
> targetService="test:service"
> targetEndpoint="database"
> host="smpp.example.com"
> port="2700"
> systemId="user"
> password="passwd"/>
> This SMPP consumer endpoint will receive messages from the SMPP server
> and route it to the database endpoint.
> 2/ Bean SU with the following xbean.xml:
>
> <bean:endpoint service="test:service" endpoint="database"
> bean="#databaseBean"/>
> <bean id="databaseBean" class="com.example.DatabaseBean"/>
> </beans>
>
> The DatabaseBean takes the incoming message (as formatted by the SMPP
> endpoint), parse it to extract data and store into a database.
> I let you code the DatabaseBean using the sample.
>
> Regards
> JB
>
> gardion1 wrote:
>> Hello all,
>>
>> I'm fairly new to service mix but I have installed it and followed the
>> tutorials 1-3. Seeing as service mix is new to me I thought I would ask
>> what the best approach would be for solving a problem
>>
>> I am working on a service that would take messages received from smpp and
>> write them to a mysql database. (the sms message that comes in will
>> contain
>> xml like <mymessage>hello<mymessage>)
>>
>> what jbi components would be the best to use in order to do that? I know
>> about the servicemix-smpp and I have managed to set it up to receive
>> messages from an smsc emulator. However, what other components would I
>> need
>> to talk to mysql? I'm assuming I would use JDBC to do that.
>>
>> I will also be doing the reverse and having the mysql database send an
>> xml
>> message that should be sent out by smpp.
>>
>> Any thoughts?
>>
>> Thank you,
>>
>> Joel
>>
>
>
--
View this message in context: http://www.nabble.com/writing-smpp-messages-to-a-database-tp25757012p25779335.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: writing smpp messages to a database
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Joel,
for now, the servicemix-jdbc component is not yet ready.
However, you can use a servicemix-bean to store on the database. I have
written a sample to show how to do:
http://svn.apache.org/repos/asf/servicemix/smx3/trunk/samples/database-bean/
So, to summarize, you need two SUs:
1/ SMPP consumer SU with the following xbean.xml:
<smpp:consumer service="test:service"
endpoint="endpoint"
targetService="test:service"
targetEndpoint="database"
host="smpp.example.com"
port="2700"
systemId="user"
password="passwd"/>
This SMPP consumer endpoint will receive messages from the SMPP server
and route it to the database endpoint.
2/ Bean SU with the following xbean.xml:
<bean:endpoint service="test:service" endpoint="database"
bean="#databaseBean"/>
<bean id="databaseBean" class="com.example.DatabaseBean"/>
</beans>
The DatabaseBean takes the incoming message (as formatted by the SMPP
endpoint), parse it to extract data and store into a database.
I let you code the DatabaseBean using the sample.
Regards
JB
gardion1 wrote:
> Hello all,
>
> I'm fairly new to service mix but I have installed it and followed the
> tutorials 1-3. Seeing as service mix is new to me I thought I would ask
> what the best approach would be for solving a problem
>
> I am working on a service that would take messages received from smpp and
> write them to a mysql database. (the sms message that comes in will contain
> xml like <mymessage>hello<mymessage>)
>
> what jbi components would be the best to use in order to do that? I know
> about the servicemix-smpp and I have managed to set it up to receive
> messages from an smsc emulator. However, what other components would I need
> to talk to mysql? I'm assuming I would use JDBC to do that.
>
> I will also be doing the reverse and having the mysql database send an xml
> message that should be sent out by smpp.
>
> Any thoughts?
>
> Thank you,
>
> Joel
>