You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vyacheslav Koptilin (Jira)" <ji...@apache.org> on 2022/10/04 11:37:00 UTC

[jira] [Commented] (IGNITE-17747) When the Ignite server is restarted, the client cannot destroy the instantiated queue and reinstantiate it, except to restart the client application

    [ https://issues.apache.org/jira/browse/IGNITE-17747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17612574#comment-17612574 ] 

Vyacheslav Koptilin commented on IGNITE-17747:
----------------------------------------------

Hello [~Arthur Wang],

The new instance of a queue after cluster restart can be obtained via the same API method: 
* _Ignite.queue(String name, int cap, @Nullable CollectionConfiguration cfg)_

In accordance with the doc, this method create a new queue if it has not been created yet (this is your case I suppose):
{noformat}
    /**
     * Will get a named queue from cache and create one if it has not been created yet and {@code cfg} is not
     * {@code null}.
     * If queue is present already, queue properties will not be changed. Use
     * collocation for {@link CacheMode#PARTITIONED} caches if you have lots of relatively
     * small queues as it will make fetching, querying, and iteration a lot faster. If you have
     * few very large queues, then you should consider turning off collocation as they simply
     * may not fit in a single node's memory.
     *
     * @param name Name of queue.
     * @param cap Capacity of queue, {@code 0} for unbounded queue. Ignored if {@code cfg} is {@code null}.
     * @param cfg Queue configuration if new queue should be created.
     * @param <T> Type of the elements in queue.
     * @return Queue with given properties.
     * @throws IgniteException If queue could not be fetched or created.
     */
    public <T> IgniteQueue<T> queue(String name, int cap, @Nullable CollectionConfiguration cfg) throws IgniteException;
{noformat}
Please take a look at [IgniteClientReconnectCollectionsTest.testCollectionsReconnectClusterRestart |https://github.com/apache/ignite/blob/master/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java#L70]

So, you just need to call _Ignite.queue()_ method after your server restarted and provide _CollectionConfiguration_.

You can listen for _EVT_CLIENT_NODE_RECONNECTED_ in order to detect that client node reconnected to the cluster [https://ignite.apache.org/docs/latest/clustering/connect-client-nodes#client-disconnectedreconnected-events]

Please don't hesitate to reopen the issue if I missed something.

> When the Ignite server is restarted, the client cannot destroy the instantiated queue and reinstantiate it, except to restart the client application
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-17747
>                 URL: https://issues.apache.org/jira/browse/IGNITE-17747
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>            Reporter: Arthur Wang
>            Priority: Major
>         Attachments: log.png
>
>
> In the case of Ignite single-node deployment, when the Ignite server is restarted, the client cannot destroy the instantiated queue and reinstantiate it, except to restart the client application. This means that Ignite queue does not take advantage of getOrCreate's recovery mechanism like the k-v caches.Is there any good practice to restore the usability of Queue without restarting the client?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)