Skip to content

Commit

Permalink
DOCS-903: add dependencies and POJO tip; backport type-name (#1297)
Browse files Browse the repository at this point in the history
Closes SUP-455 and DOCS-903
  • Loading branch information
oliverhowell authored Sep 30, 2024
1 parent 64f9bda commit ea38a79
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 19 deletions.
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>
----

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

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

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>
----

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.

0 comments on commit ea38a79

Please sign in to comment.