Re: Can I write a route that reads an arbitrary database table and stores it in a file?
If your test is a junit test with local Camel context, then you can add data source with given DB coordinates to test registry as a part of the fixtures setup. Check out createRegistry method of CamelTestSupport class. On Jan 7, 2014 8:22 PM, Lothar Werzinger lot...@tradescape.biz wrote: Sorry for my late reply. I was quite busy. On Mon, Jan 6, 2014 at 2:06 PM, Henryk Konsek hekon...@gmail.com wrote: Hi Lothar, I was hoping for some kind of dynamic route building that would allow me to use the jdbc or sql component. In general dynamic endpoint specification can be achieved via Recipient List [1] EIP. You can use singleton list to create dynamic endpoint. The problem is that both SQL [2] and JDBC [3] components require you to specify the DataSource instance in the registry, so you need to specify them upfront and put into registry. That is exactly why asked the question ;-) BTW Why do you pass DB coordinates and credentials as the message? This is pretty unusual, to be honest. :) I agree it is. The use case is regression testing. I want to write a generic route that dumps a table to a file, so that it can be automatically compared to an already stored file. The user of the route (a regression test route) would simply pass in the database connection information, the table name and the name of the stored file to compare against. The test framework needs to be generic and can not know beforehand what db connections the actual test will need to use. Cheers. [1] http://camel.apache.org/recipient-list.html [2] http://camel.apache.org/sql-component.html [3] http://camel.apache.org/jdbc -- Henryk Konsek http://henryk-konsek.blogspot.com -- Lothar Werzinger Principal Architect Tradescape, Inc. - Enabling Efficient Digital Marketplaces +1-650-931-6719 (direct) +1-800-697-6068 (main) Ext. 116 lot...@tradescape.biz http://www.tradescape.biz -- This message and any attachment (the message) is intended solely for the addressees and is confidential. If you receive this message by mistake, please delete it and notify the sender immediately. Any use not in accordance with its purpose, any out-spread or disclosure, either as a whole or partially, is prohibited except with formal approval. Internet cannot guarantee the integrity of this message, therefore Tradescape will not be liable for the message if modified. -
Re: Can I write a route that reads an arbitrary database table and stores it in a file?
Sorry for my late reply. I was quite busy. On Mon, Jan 6, 2014 at 2:06 PM, Henryk Konsek hekon...@gmail.com wrote: Hi Lothar, I was hoping for some kind of dynamic route building that would allow me to use the jdbc or sql component. In general dynamic endpoint specification can be achieved via Recipient List [1] EIP. You can use singleton list to create dynamic endpoint. The problem is that both SQL [2] and JDBC [3] components require you to specify the DataSource instance in the registry, so you need to specify them upfront and put into registry. That is exactly why asked the question ;-) BTW Why do you pass DB coordinates and credentials as the message? This is pretty unusual, to be honest. :) I agree it is. The use case is regression testing. I want to write a generic route that dumps a table to a file, so that it can be automatically compared to an already stored file. The user of the route (a regression test route) would simply pass in the database connection information, the table name and the name of the stored file to compare against. The test framework needs to be generic and can not know beforehand what db connections the actual test will need to use. Cheers. [1] http://camel.apache.org/recipient-list.html [2] http://camel.apache.org/sql-component.html [3] http://camel.apache.org/jdbc -- Henryk Konsek http://henryk-konsek.blogspot.com -- Lothar Werzinger Principal Architect Tradescape, Inc. - Enabling Efficient Digital Marketplaces +1-650-931-6719 (direct) +1-800-697-6068 (main) Ext. 116 lot...@tradescape.biz http://www.tradescape.biz -- This message and any attachment (the message) is intended solely for the addressees and is confidential. If you receive this message by mistake, please delete it and notify the sender immediately. Any use not in accordance with its purpose, any out-spread or disclosure, either as a whole or partially, is prohibited except with formal approval. Internet cannot guarantee the integrity of this message, therefore Tradescape will not be liable for the message if modified. -
Re: Can I write a route that reads an arbitrary database table and stores it in a file?
I was afraid that I might have to implement that as Java code in a processor. I was hoping for some kind of dynamic route building that would allow me to use the jdbc or sql component. Thanks anyway On Fri, Jan 3, 2014 at 5:46 PM, James Carman ja...@carmanconsulting.comwrote: It's possible, but probably not advisable. :) from(cxf:bean:foo).process(new Processor() { @Override public void process(Exchange exchange) throws Exception { // Query the database and build up the JSONifiable data structure here... } }).marshal(new JsonDataFormat()).to(file:foo); On Fri, Jan 3, 2014 at 8:34 PM, Lothar Werzinger lot...@tradescape.biz wrote: Hi, I have the requirement to write a route that listens on a web service endpoint and that is supposed to read a database table where the connection information (host, port, ...) and the table name are passed in via the web service call, convert the table data to JSON and write it to a file. Is such a route possible? If yes, can you please point me in the right direction? Thanks in advance! -- Lothar Werzinger Principal Architect Tradescape, Inc. - Enabling Efficient Digital Marketplaces +1-650-931-6719 (direct) +1-800-697-6068 (main) Ext. 116 lot...@tradescape.biz http://www.tradescape.biz -- This message and any attachment (the message) is intended solely for the addressees and is confidential. If you receive this message by mistake, please delete it and notify the sender immediately. Any use not in accordance with its purpose, any out-spread or disclosure, either as a whole or partially, is prohibited except with formal approval. Internet cannot guarantee the integrity of this message, therefore Tradescape will not be liable for the message if modified. - -- Lothar Werzinger Principal Architect Tradescape, Inc. - Enabling Efficient Digital Marketplaces +1-650-931-6719 (direct) +1-800-697-6068 (main) Ext. 116 lot...@tradescape.biz http://www.tradescape.biz -- This message and any attachment (the message) is intended solely for the addressees and is confidential. If you receive this message by mistake, please delete it and notify the sender immediately. Any use not in accordance with its purpose, any out-spread or disclosure, either as a whole or partially, is prohibited except with formal approval. Internet cannot guarantee the integrity of this message, therefore Tradescape will not be liable for the message if modified. -
Re: Can I write a route that reads an arbitrary database table and stores it in a file?
Yeah, I don't think the SQL component will work for you, since it requires a DataSource object up front. Perhaps you can borrow from it? That would be overkill IMHO, though On Mon, Jan 6, 2014 at 9:22 AM, Lothar Werzinger lot...@tradescape.biz wrote: I was afraid that I might have to implement that as Java code in a processor. I was hoping for some kind of dynamic route building that would allow me to use the jdbc or sql component. Thanks anyway On Fri, Jan 3, 2014 at 5:46 PM, James Carman ja...@carmanconsulting.comwrote: It's possible, but probably not advisable. :) from(cxf:bean:foo).process(new Processor() { @Override public void process(Exchange exchange) throws Exception { // Query the database and build up the JSONifiable data structure here... } }).marshal(new JsonDataFormat()).to(file:foo); On Fri, Jan 3, 2014 at 8:34 PM, Lothar Werzinger lot...@tradescape.biz wrote: Hi, I have the requirement to write a route that listens on a web service endpoint and that is supposed to read a database table where the connection information (host, port, ...) and the table name are passed in via the web service call, convert the table data to JSON and write it to a file. Is such a route possible? If yes, can you please point me in the right direction? Thanks in advance! -- Lothar Werzinger Principal Architect Tradescape, Inc. - Enabling Efficient Digital Marketplaces +1-650-931-6719 (direct) +1-800-697-6068 (main) Ext. 116 lot...@tradescape.biz http://www.tradescape.biz -- This message and any attachment (the message) is intended solely for the addressees and is confidential. If you receive this message by mistake, please delete it and notify the sender immediately. Any use not in accordance with its purpose, any out-spread or disclosure, either as a whole or partially, is prohibited except with formal approval. Internet cannot guarantee the integrity of this message, therefore Tradescape will not be liable for the message if modified. - -- Lothar Werzinger Principal Architect Tradescape, Inc. - Enabling Efficient Digital Marketplaces +1-650-931-6719 (direct) +1-800-697-6068 (main) Ext. 116 lot...@tradescape.biz http://www.tradescape.biz -- This message and any attachment (the message) is intended solely for the addressees and is confidential. If you receive this message by mistake, please delete it and notify the sender immediately. Any use not in accordance with its purpose, any out-spread or disclosure, either as a whole or partially, is prohibited except with formal approval. Internet cannot guarantee the integrity of this message, therefore Tradescape will not be liable for the message if modified. -
Re: Can I write a route that reads an arbitrary database table and stores it in a file?
Hi Lothar, I was hoping for some kind of dynamic route building that would allow me to use the jdbc or sql component. In general dynamic endpoint specification can be achieved via Recipient List [1] EIP. You can use singleton list to create dynamic endpoint. The problem is that both SQL [2] and JDBC [3] components require you to specify the DataSource instance in the registry, so you need to specify them upfront and put into registry. BTW Why do you pass DB coordinates and credentials as the message? This is pretty unusual, to be honest. :) Cheers. [1] http://camel.apache.org/recipient-list.html [2] http://camel.apache.org/sql-component.html [3] http://camel.apache.org/jdbc -- Henryk Konsek http://henryk-konsek.blogspot.com
Can I write a route that reads an arbitrary database table and stores it in a file?
Hi, I have the requirement to write a route that listens on a web service endpoint and that is supposed to read a database table where the connection information (host, port, ...) and the table name are passed in via the web service call, convert the table data to JSON and write it to a file. Is such a route possible? If yes, can you please point me in the right direction? Thanks in advance! -- Lothar Werzinger Principal Architect Tradescape, Inc. - Enabling Efficient Digital Marketplaces +1-650-931-6719 (direct) +1-800-697-6068 (main) Ext. 116 lot...@tradescape.biz http://www.tradescape.biz -- This message and any attachment (the message) is intended solely for the addressees and is confidential. If you receive this message by mistake, please delete it and notify the sender immediately. Any use not in accordance with its purpose, any out-spread or disclosure, either as a whole or partially, is prohibited except with formal approval. Internet cannot guarantee the integrity of this message, therefore Tradescape will not be liable for the message if modified. -
Re: Can I write a route that reads an arbitrary database table and stores it in a file?
It's possible, but probably not advisable. :) from(cxf:bean:foo).process(new Processor() { @Override public void process(Exchange exchange) throws Exception { // Query the database and build up the JSONifiable data structure here... } }).marshal(new JsonDataFormat()).to(file:foo); On Fri, Jan 3, 2014 at 8:34 PM, Lothar Werzinger lot...@tradescape.biz wrote: Hi, I have the requirement to write a route that listens on a web service endpoint and that is supposed to read a database table where the connection information (host, port, ...) and the table name are passed in via the web service call, convert the table data to JSON and write it to a file. Is such a route possible? If yes, can you please point me in the right direction? Thanks in advance! -- Lothar Werzinger Principal Architect Tradescape, Inc. - Enabling Efficient Digital Marketplaces +1-650-931-6719 (direct) +1-800-697-6068 (main) Ext. 116 lot...@tradescape.biz http://www.tradescape.biz -- This message and any attachment (the message) is intended solely for the addressees and is confidential. If you receive this message by mistake, please delete it and notify the sender immediately. Any use not in accordance with its purpose, any out-spread or disclosure, either as a whole or partially, is prohibited except with formal approval. Internet cannot guarantee the integrity of this message, therefore Tradescape will not be liable for the message if modified. -