Skip to content

INT-2674 - Add Channel-specific JDBC Message Store - #676

Closed
ghillert wants to merge 9 commits into
spring-projects:masterfrom
ghillert:INT-2674
Closed

ghillert wants to merge 9 commits into
spring-projects:masterfrom
ghillert:INT-2674

Conversation

@ghillert

Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to document/WARN that using a shared JdbcTemplate should be used with care because it's fetchSize property will be set to 1.

Comment thread build.gradle Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':spring-integration-jdbc:testCompile'.
> Could not find group:com.oracle, module:ojdbc6, version:11.2.0.3.
  Required by:
      org.springframework.integration:spring-integration-jdbc:2.2.0.BUILD-SNAPSHOT

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this worked...

        maven { url 'https://code.lds.org/nexus/content/groups/main-repo' }

...but it's probably not Kosher

@garyrussell

Copy link
Copy Markdown
Contributor

Now I'm getting...

:spring-integration-jdbc:test

org.springframework.integration.jdbc.JdbcChannelMessageStoreTests > testGetNonExistentMessageFromGroup FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.dao.DataAccessResourceFailureException
                    Caused by: org.springframework.jdbc.datasource.init.ScriptStatementFailedException
                        Caused by: java.sql.SQLException
                            Caused by: org.apache.derby.impl.jdbc.EmbedSQLException
                                Caused by: org.apache.derby.iapi.error.StandardException

161 tests completed, 1 failed

Only seems to happen when running from gradle...

Caused by: ERROR X0Y32: Table/View 'INT_CHANNEL_MESSAGE' already exists in Schema 'SA'.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is 'int21' ??

@ghillert

Copy link
Copy Markdown
Contributor Author

@garyrussell Should build now. Also, HSQL is now the default DB for testing. It looks like databases need to support Multiversion Concurrency Control (MVCC) when hitting the message store with multiple threads. Derby does not and does not show good performance.

I will make the other changes later tonight.

* Refactor Test Cases
* Code Review Changes
@ghillert

Copy link
Copy Markdown
Contributor Author

Just pushed a new commit 268ebd0 which includes:

  • Add documentation
  • Refactor Test Cases
  • Code Review Changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Gary said before we should document this jdbcTemplate limitation.
By the way there are another solution: JdbcOperations#execute(StatementCallback<T> action). And further we may use logic of applyStatementSettings manualy. In this case jdbcTemplate will free for shared usage as before. Similar solution is in org.springframework.batch.item.database.JdbcCursorItemReader
WDYT?
Of course, it may be changed in the 3.0, as you said in the JavaDocs, Gunnar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored this area a bit. I will set the fetch-size and max-rows property (to 1), only if the data-source is passed into the class and a fresh JDBC-template is instantiated. Otherwise I added documentation mentioning that this property is important when using Oracle for persistence and users should pass in a corresponding JdbcTemplate instance. However, I am not changing their passed in JdbcTemplate instance.

However, a warning-level message is now logged if the fetchSize is >1 (in afterPropertiesSet).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Timestamp type strips out any milliseconds and reduces the precision to seconds. If multiple messages arre inserted within the same second, they will be returned from the queue in an unordered fashion. Would it make sense to instead use milliseconds since epoch, e.g., a long value, for sorting purposes here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Fractional Time is actually supported in MySQL 5.6.4:

http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html

but since we aren't doing any time calculations, I agree and we should store the time in ms as a long value. For 3.0 we may consider using sequential ids.

@garyrussell

Copy link
Copy Markdown
Contributor

I wonder if we should provide a SimpleQueryProvider that takes the two abstract queries as constructor arguments.

That way, someone could simply wire up a with the appropriate queries for his DB rather than forcing him to implement a concrete class

??

Comment thread src/reference/docbook/jdbc.xml Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix classname

@garyrussell

Copy link
Copy Markdown
Contributor

Just these few minor comments; plus removing the "dead" tests to a different branch for now; and then I think we are good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants