You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Julian Cable (JIRA)" <ji...@apache.org> on 2011/06/25 00:41:47 UTC

[jira] [Created] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

documentation for jdbc idempotent repository - use with spring DSL
------------------------------------------------------------------

                 Key: CAMEL-4151
                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
             Project: Camel
          Issue Type: Improvement
          Components: camel-sql
    Affects Versions: 2.7.1
         Environment: camels on win2k3, mysql(5.5.8) on win2k3
            Reporter: Julian Cable
            Assignee: Christian Müller
             Fix For: 2.8.0


When running several camels with an idempotent repository (based on
jdbc to mysql) I haven't found any documentation for the table-definition or for changing parameters (like table-name).

Getting through the sources, I tried out following definition on mysql that works for me:

CREATE TABLE IF NOT EXISTS `camel_messageprocessed` (
 `messageId` varchar(255) NOT NULL,
 `processorName` varchar(255) NOT NULL,
 PRIMARY KEY (`messageId`)
)

Please check this back.
 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

Posted by "Julian Cable (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055179#comment-13055179 ] 

Julian Cable commented on CAMEL-4151:
-------------------------------------

That makes sense - its not a big problem, your code seems to work with MySQL, but it takes a bit of care to get this right. I don't think it would work with Postgres unless one was very careful with the create statement, and Postgres is very standards compliant. It might be worth listing the actual insert and select statements you use on the documentation page to give people a hint - for example, I presume you don't quote the field names at all?

> documentation for jdbc idempotent repository - use with spring DSL
> ------------------------------------------------------------------
>
>                 Key: CAMEL-4151
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: docuentation, idempotent, jdbc
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:
> 	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
> 		<constructor-arg index="0" ref="myJDBC"/>
> 		<constructor-arg index="1" value="foobar"/>
> 	</bean>
> 	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> 		<property name="url" value="${myJDBC.uri}" />
> 		<property name="username" value="${myJDBC.username}" />
> 		<property name="password" value="${myJDBC.password}" />
> 	</bean>
> I think it would be better if the class had a default constructor and looked for properties.
> Julian

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

Posted by "Julian Cable (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055161#comment-13055161 ] 

Julian Cable commented on CAMEL-4151:
-------------------------------------

Hi Christian, that's great. Pity it didn't show up in my Google searches. I think we really need a link from http://camel.apache.org/idempotent-consumer.html to http://camel.apache.org/sql-component.html.

In terms of not showing the key syntax, there is a perfectly good SQL94 syntax for this. Its much more uniform than your mixed case variable name syntax. But your docs are good.

Julian

> documentation for jdbc idempotent repository - use with spring DSL
> ------------------------------------------------------------------
>
>                 Key: CAMEL-4151
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: docuentation, idempotent, jdbc
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:
> 	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
> 		<constructor-arg index="0" ref="myJDBC"/>
> 		<constructor-arg index="1" value="foobar"/>
> 	</bean>
> 	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> 		<property name="url" value="${myJDBC.uri}" />
> 		<property name="username" value="${myJDBC.username}" />
> 		<property name="password" value="${myJDBC.password}" />
> 	</bean>
> I think it would be better if the class had a default constructor and looked for properties.
> Julian

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

Posted by "Julian Cable (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054829#comment-13054829 ] 

Julian Cable commented on CAMEL-4151:
-------------------------------------

I meant to add an example route:

<route>
	<from uri="seda:in"/>
	<setHeader headerName="someHeader">
		<xpath resultType="java.lang.String">//Key</xpath>
	</setHeader>
	<doTry>
		<idempotentConsumer messageIdRepositoryRef="myRepo">
			<header>someHeader</header>
			<to uri="seda:out"/>
		</idempotentConsumer>
		<doCatch>
			<!-- I have not found the right set of exceptions to catch for this :( -->
			<exception>java.net.ConnectException</exception>
			<!-- If we can't access the repository, play safe and deliver the message -->
			<to uri="seda:out"/>
		</doCatch>
	</doTry>
</route>



> documentation for jdbc idempotent repository - use with spring DSL
> ------------------------------------------------------------------
>
>                 Key: CAMEL-4151
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: docuentation, idempotent, jdbc
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:
> 	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
> 		<constructor-arg index="0" ref="myJDBC"/>
> 		<constructor-arg index="1" value="foobar"/>
> 	</bean>
> 	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> 		<property name="url" value="${myJDBC.uri}" />
> 		<property name="username" value="${myJDBC.username}" />
> 		<property name="password" value="${myJDBC.password}" />
> 	</bean>
> I think it would be better if the class had a default constructor and looked for properties.
> Julian

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Closed] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

Posted by "Christian Müller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Müller closed CAMEL-4151.
-----------------------------------

    Resolution: Invalid

The suggested documentation is already done [here|https://cwiki.apache.org/confluence/display/CAMEL/SQL+Component]

> documentation for jdbc idempotent repository - use with spring DSL
> ------------------------------------------------------------------
>
>                 Key: CAMEL-4151
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: docuentation, idempotent, jdbc
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:
> 	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
> 		<constructor-arg index="0" ref="myJDBC"/>
> 		<constructor-arg index="1" value="foobar"/>
> 	</bean>
> 	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> 		<property name="url" value="${myJDBC.uri}" />
> 		<property name="username" value="${myJDBC.username}" />
> 		<property name="password" value="${myJDBC.password}" />
> 	</bean>
> I think it would be better if the class had a default constructor and looked for properties.
> Julian

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

Posted by "Christian Müller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055182#comment-13055182 ] 

Christian Müller commented on CAMEL-4151:
-----------------------------------------

No, we not quote the column names. We use the column names as described on the wiki page. This should work...
Do you already had issues with the JdbcMessageIdRepository and Postgres?

> documentation for jdbc idempotent repository - use with spring DSL
> ------------------------------------------------------------------
>
>                 Key: CAMEL-4151
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: docuentation, idempotent, jdbc
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:
> 	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
> 		<constructor-arg index="0" ref="myJDBC"/>
> 		<constructor-arg index="1" value="foobar"/>
> 	</bean>
> 	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> 		<property name="url" value="${myJDBC.uri}" />
> 		<property name="username" value="${myJDBC.username}" />
> 		<property name="password" value="${myJDBC.password}" />
> 	</bean>
> I think it would be better if the class had a default constructor and looked for properties.
> Julian

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

Posted by "Christian Müller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055165#comment-13055165 ] 

Christian Müller commented on CAMEL-4151:
-----------------------------------------

I also doesn't like the camel case syntax for the column names, but I decided to use the same table/column names as the JpaMessageIdRepository.
I will add the links in a few minutes...

> documentation for jdbc idempotent repository - use with spring DSL
> ------------------------------------------------------------------
>
>                 Key: CAMEL-4151
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: docuentation, idempotent, jdbc
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:
> 	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
> 		<constructor-arg index="0" ref="myJDBC"/>
> 		<constructor-arg index="1" value="foobar"/>
> 	</bean>
> 	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> 		<property name="url" value="${myJDBC.uri}" />
> 		<property name="username" value="${myJDBC.username}" />
> 		<property name="password" value="${myJDBC.password}" />
> 	</bean>
> I think it would be better if the class had a default constructor and looked for properties.
> Julian

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

Posted by "Julian Cable (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Cable updated CAMEL-4151:
--------------------------------

         Fix Version/s:     (was: 2.8.0)
           Description: 
 I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:

	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
		<constructor-arg index="0" ref="myJDBC"/>
		<constructor-arg index="1" value="foobar"/>
	</bean>

	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
		<property name="url" value="${myJDBC.uri}" />
		<property name="username" value="${myJDBC.username}" />
		<property name="password" value="${myJDBC.password}" />
	</bean>

I think it would be better if the class had a default constructor and looked for properties.

Julian

  was:
When running several camels with an idempotent repository (based on
jdbc to mysql) I haven't found any documentation for the table-definition or for changing parameters (like table-name).

Getting through the sources, I tried out following definition on mysql that works for me:

CREATE TABLE IF NOT EXISTS `camel_messageprocessed` (
 `messageId` varchar(255) NOT NULL,
 `processorName` varchar(255) NOT NULL,
 PRIMARY KEY (`messageId`)
)

Please check this back.
 

           Environment: camels on any  (was: camels on win2k3, mysql(5.5.8) on win2k3)
    Remaining Estimate: 1h
     Original Estimate: 1h

> documentation for jdbc idempotent repository - use with spring DSL
> ------------------------------------------------------------------
>
>                 Key: CAMEL-4151
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: docuentation, idempotent, jdbc
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:
> 	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
> 		<constructor-arg index="0" ref="myJDBC"/>
> 		<constructor-arg index="1" value="foobar"/>
> 	</bean>
> 	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> 		<property name="url" value="${myJDBC.uri}" />
> 		<property name="username" value="${myJDBC.username}" />
> 		<property name="password" value="${myJDBC.password}" />
> 	</bean>
> I think it would be better if the class had a default constructor and looked for properties.
> Julian

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAMEL-4151) documentation for jdbc idempotent repository - use with spring DSL

Posted by "Julian Cable (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055681#comment-13055681 ] 

Julian Cable commented on CAMEL-4151:
-------------------------------------

I checked (a while since I used postgres, although it remains my favourite, especially for geospatial work).

As long as you always omit quotes on fields and database names all is well. So no change needed. However, when I see the statement:

CREATE TABLE CAMEL_MESSAGEPROCESSED (
  processorName VARCHAR(255),
  messageId VARCHAR(100),
  createdAt TIMESTAMP
);

I expect to get a table called MESSAGEPROCESSED whereas in postgres I get camel_messageprocessed. I expect fields to be called processorName, messageId and createdAt whereas I actually get processorname, messageid and createdat. So I want to change the create to:

CREATE TABLE "CAMEL_MESSAGEPROCESSED" (
  "processorName" VARCHAR(255),
  "messageId" VARCHAR(100),
  "createdAt" TIMESTAMP
);

But then the queries will fail. So its OK, we just need to do it as your documentation says, I just find it confusing to have camel case on identifiers when the code relies on the case being not significant. I guess that's my problem, not yours. :)

Julian

 



> documentation for jdbc idempotent repository - use with spring DSL
> ------------------------------------------------------------------
>
>                 Key: CAMEL-4151
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4151
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: docuentation, idempotent, jdbc
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  I couldn't find any reference to using this with spring DSL. I came up with this which seems to work:
> 	<bean id="myRepo" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
> 		<constructor-arg index="0" ref="myJDBC"/>
> 		<constructor-arg index="1" value="foobar"/>
> 	</bean>
> 	<bean id="myJDBC" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
> 		<property name="url" value="${myJDBC.uri}" />
> 		<property name="username" value="${myJDBC.username}" />
> 		<property name="password" value="${myJDBC.password}" />
> 	</bean>
> I think it would be better if the class had a default constructor and looked for properties.
> Julian

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira