Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS-903: add dependencies and POJO tip; backport type-name #1297

Merged
merged 6 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions docs/modules/mapstore/pages/configuring-a-generic-maploader.adoc
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
= Using the Generic MapLoader
= Using the generic MapLoader
:description: With the xref:working-with-external-data.adoc#options[generic MapLoader], you can configure a map to cache data from an external system. This topic includes an example of how to configure a map with a generic MapLoader that connects to a MySQL database.
:page-beta: false

{description}

NOTE: The objects created in the distributed map are stored as GenericRecord. You can use the `type-name` property to store the data in a POJO (Plain Old Java Object).

For a list of all supported external systems, including databases, see available xref:external-data-stores:external-data-stores.adoc#connectors[data connection types].

== Before you Begin
== Before you begin

You need a xref:external-data-stores:external-data-stores.adoc[data connection] that's configured on all cluster members.

== Quickstart Configuration
== Add dependencies

If you are using a Hazelcast JAR file, you need to ensure the following is added to your classpath:

[source,xml]
----
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-sql</artifactId>
</dependency>

<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-mapstore</artifactId>
</dependency>
----

oliverhowell marked this conversation as resolved.
Show resolved Hide resolved
NOTE: If you are using the slim distribution, you need to add `hazelcast-mapstore`. If you are using MongoDb, you also need to add `hazelcast-jet-mongodb`.

== Quickstart configuration

This example shows a basic map configuration that uses a data connection called `my-mysql-database`. See xref:data-structures:map.adoc[] for the details of other properties that you can include in your map configuration.

Expand Down Expand Up @@ -70,11 +91,11 @@ instance().getConfig().addMapConfig(mapConfig);
<2> The name of your data connection.

[[mapping]]
== SQL Mapping for the Generic MapLoader
== SQL mapping for the generic MapLoader
oliverhowell marked this conversation as resolved.
Show resolved Hide resolved

When you configure a map with the generic MapLoader, Hazelcast creates a xref:sql:mapping-to-jdbc.adoc[SQL mapping with the JDBC connector]. The name of the mapping is the same name as your map prefixed with `__map-store.`. This mapping is used to read data from the external system, and it is removed whenever the configured map is removed. You can also configure this SQL mapping, using <<data-connection-ref, configuration properties>>.
When you configure a map with the generic MapLoader, Hazelcast creates a xref:sql:mapping-to-jdbc.adoc[SQL mapping with the JDBC connector]. The name of the mapping is the same name as your map prefixed with `__map-store.`. This mapping is used to read data from the external system, and is removed whenever the configured map is removed. You can also configure this SQL mapping, using <<data-connection-ref, configuration properties>>.

== Configuration Properties for the Generic MapLoader
== Configuration properties for the generic MapLoader
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
== Configuration properties for the generic MapLoader
== Configuration properties for the Generic MapLoader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And is generic mapStore correct then?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, IMHO should have the same case. This case is used also in the title btw.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've looked at the other sources and I think we should refer to "generic MapLoader" in normal text. I know in code it is "Generic.MapLoader" and we use that when specifically including or referring to code (if we always used code names then our docs and marketing content would be all over the place). Check latest commit for proposed version.


These configuration properties allow you to configure the generic MapLoader and its SQL mapping.

Expand Down Expand Up @@ -436,19 +457,19 @@ mapConfig.setMapStoreConfig(mapStoreConfig);

== Supported backends

GenericMapStore needs a SQL Connector that supports `SELECT`, `UPDATE`, `SINK INTO` and `DELETE` statements.
The generic MapStore needs a SQL Connector that supports `SELECT`, `UPDATE`, `SINK INTO` and `DELETE` statements.

Officially supported connectors:

- MySQL, PostgreSQL, Microsoft SQL Server, Oracle (it uses JDBC SQL Connector).
- MongoDB (make sure you have `hazelcast-jet-mongodb` artifact included on the classpath).

== Related Resources
== Related resources

- To monitor MapStores for each loaded entry, use the `EntryLoadedListener` interface. See the xref:events:object-events.adoc#listening-for-map-events[Listening for Map Events section] to learn how you can catch entry-based events.

- xref:mapstore-triggers.adoc[].

== Next Steps
== Next steps

See the MapStore xref:configuration-guide.adoc[configuration guide] for details about configuration options, including caching behaviors.
See the xref:configuration-guide.adoc[MapStore configuration guide] for details about configuration options, including caching behaviors.
39 changes: 30 additions & 9 deletions docs/modules/mapstore/pages/configuring-a-generic-mapstore.adoc
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
= Using the Generic MapStore
= Using the generic MapStore
:description: With the xref:working-with-external-data.adoc#options[generic MapStore], you can configure a map to cache data from and write data back to an external system. This topic includes an example of how to configure a map with a generic MapStore that connects to a MySQL database.
:page-beta: false

{description}

NOTE: The objects created in the distributed map are stored as GenericRecord. You can use the `type-name` property to store the data in a POJO (Plain Old Java Object).

For a list of all supported external systems, including databases, see available xref:external-data-stores:external-data-stores.adoc#connectors[data connection types].

== Before you Begin
== Before you begin

You need a xref:external-data-stores:external-data-stores.adoc[data connection] that's configured on all cluster members.

== Quickstart Configuration
== Add dependencies

If you are using a Hazelcast JAR file, you need to ensure the following is added to your classpath:

[source,xml]
----
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-sql</artifactId>
</dependency>

<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-mapstore</artifactId>
</dependency>
----

oliverhowell marked this conversation as resolved.
Show resolved Hide resolved
NOTE: If you are using the slim distribution, you need to add `hazelcast-mapstore`. If you are using MongoDb, you also need to add `hazelcast-jet-mongodb`.

== Quickstart configuration

This example shows a basic map configuration that uses a data connection called `my-mysql-database`. See xref:data-structures:map.adoc[] for the details of other properties that you include in your map configuration.

Expand Down Expand Up @@ -70,11 +91,11 @@ instance().getConfig().addMapConfig(mapConfig);
<2> The name of your data connection.

[[mapping]]
== SQL Mapping for the Generic MapStore
== SQL mapping for the generic MapStore

When you configure a map with the generic MapStore, Hazelcast creates a xref:sql:mapping-to-jdbc.adoc[SQL mapping with the JDBC connector]. The name of the mapping is the same name as your map prefixed with `__map-store.`. This mapping is used to read data from or write data to the external system and it is removed whenever the configured map is removed. You can also configure this SQL mapping, using <<data-connection-ref, configuration properties>>.
When you configure a map with the generic MapStore, Hazelcast creates a xref:sql:mapping-to-jdbc.adoc[SQL mapping with the JDBC connector]. The name of the mapping is the same name as your map prefixed with `__map-store.`. This mapping is used to read data from or write data to the external system and is removed whenever the configured map is removed. You can also configure this SQL mapping, using <<data-connection-ref, configuration properties>>.

== Configuration Properties for the Generic MapStore
== Configuration properties for the generic MapStore

These configuration properties allow you to configure the generic MapStore and its SQL mapping.

Expand Down Expand Up @@ -436,19 +457,19 @@ mapConfig.setMapStoreConfig(mapStoreConfig);

== Supported backends

GenericMapStore needs a SQL Connector that supports `SELECT`, `UPDATE`, `SINK INTO` and `DELETE` statements.
The generic MapStore needs a SQL Connector that supports `SELECT`, `UPDATE`, `SINK INTO` and `DELETE` statements.

Officially supported connectors:

- MySQL, PostgreSQL, Microsoft SQL Server, Oracle (it uses JDBC SQL Connector).
- MongoDB (make sure you have `hazelcast-jet-mongodb` artifact included on the classpath).

== Related Resources
== Related resources

- To monitor MapStores for each loaded entry, use the `EntryLoadedListener` interface. See the xref:events:object-events.adoc#listening-for-map-events[Listening for Map Events section] to learn how you can catch entry-based events.

- xref:mapstore-triggers.adoc[].

== Next Steps

See the MapStore xref:configuration-guide.adoc[configuration guide] for details about configuration options, including caching behaviors.
See the xref:configuration-guide.adoc[MapStore configuration guide] for details about configuration options, including caching behaviors.