-
1. Re: helloworld_sql_action
kurtstam Jul 16, 2007 6:35 PM (in response to swats)It explains how you can use a table in the db as a message channel (bus).
-
2. Re: helloworld_sql_action
kurtstam Jul 16, 2007 6:35 PM (in response to swats)darn the answer is longer then the question
-
3. Re: helloworld_sql_action
marklittle Jul 17, 2007 4:56 AM (in response to swats)Go to the wiki and follow the link to the quickstart overview.
-
4. Re: helloworld_sql_action
bsheward Jul 27, 2007 1:00 PM (in response to swats)The link http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossESBQuickStart clearly states:
helloworld_sql_action - demonstrates the use of the SQL listener/poller
So, the SQL Listener is configured using the following XML:<sql-provider name="SQLprovider" url="jdbc:sqlserver://localhost\SQLEXPRESS;initialCatalog=dbo;databaseName=dbo;" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" username="sa" password="password" > <sql-bus busid="vioeTaskSQLChannel" > <sql-message-filter tablename="dbo.task_queue" status-column="details" message-id-column="id" /> </sql-bus> </sql-provider>
The source code can be found at trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/SqlTableGatewayListener.java
The SqlTableGatewayListener periodically polls the database using a SQL statement similar to:select _selectFields from _tableName where _where and _status like ' _sLike%' order by _orderBy
The SQL statement is build as:
_selectFields is optional and can be defined using the selectFields attribute in the sql-message-filter.
_tableName is from the XML configuration's tablename attribute, in the case of the XML config above, "dbo.task_queue".
_where is optional and not shown in the XML configuration above. It can be defined using the whereCondition attribute in the sql-message-filter.
_status it expects to find in the column defined as status-column, in this case "details".
_sLike is optional and not shown in the XML configuration above. It can be defined using the inProcessValues attribute in the sql-message-filter. By default is looking for "P", the default possible states are:
P - Pending
W - Working
E - Error
D - Done
_orderBy is optional and not shown in the XML configuration above. It can be defined using the orderBy attribute in the sql-message-filter.
Whatever results are returned from the select, these are put into a message.
Are there any plans for a JBoss ESB Listener Configuration Guide, similar to the Message Action Guide? -
5. Re: Re: helloworld_sql_action
jrms_pnf Apr 23, 2014 4:10 PM (in response to bsheward)It is possble force the ESB to insert "status" E = error in some cases?
-
6. Re: helloworld_sql_action
tcunning Apr 24, 2014 10:21 AM (in response to jrms_pnf)Joao, what cases are you trying to insert status "E" for?
-
7. Re: helloworld_sql_action
jrms_pnf Apr 24, 2014 10:57 AM (in response to tcunning)Hi Tom,
i have a few doubts...
1 - when the status is changed to 'D' when all actions are done? ( in my code looks like is in the begin action )
2- 'E' in my case i use a load contra table that have the information that i want copy to other DB. so all the logic is in the action.
in the cases that the data is already in the DB for example i want set the status 'E', then i know that we have some problems with that row.thanks
-
8. Re: helloworld_sql_action
tcunning Apr 24, 2014 2:28 PM (in response to jrms_pnf)Joao, I don't think there's an easy way to do this. The statuses represent the success or failure of the gateway, not the processing of the bus. I think you are going to have to handle whatever custom checks you're proposing here with a custom action.
It sounds like you're doing a bit of database processing in ESB, might be worth it to suggest taking a look at the BreakingWoods dbutils extension, see if that helps you any :