Skip to content

Datagate lock collection problem #12

@ariel-lenis

Description

@ariel-lenis

Hi,
Im testing an android application with datagate, currently my server is exposing the datagate ports in the Dockerfile:

ENV DATAGATE_HTTP_PORT "8080"
ENV DATAGATE_HTTPS_PORT "8443"
ENV DATAGATE_MONITOR_PORT "9090"
ENV DATAGATE_KEY_STORE "keystore.jks"
ENV DATAGATE_KEY_PASSWORD "s3cret"

And this is an example of my test:

        NitriteCollection booksCollection =  db.getCollection("Books");

        if (booksCollection.find(eq("name", "Lost Symbol")).firstOrDefault() == null) {
            Document newBook = new Document();
            newBook.put("name", "Lost Symbol");
            newBook.put("author", "Dan Brown");
            booksCollection.insert(newBook);
        }

        DataGateClient dataGateClient = new DataGateClient("http://myserver:8080")
                .withAuth("admin", "somePassword");

        DataGateSyncTemplate syncTemplate = new DataGateSyncTemplate(dataGateClient, "Books@admin");

        // create sync handle
        SyncHandle syncHandle = Replicator.of(db)
                .forLocal(booksCollection)
                // a DataGate sync template implementation
                .withSyncTemplate(syncTemplate)
                // replication attempt delay of 1 sec
                .delay(timeSpan(10, TimeUnit.SECONDS))
                // both-way replication
                .ofType(ReplicationType.PUSH)
                // sync event listener
                .withListener(new SyncEventListener() {
                    @Override
                    public void onSyncEvent(SyncEventData eventInfo) {
                        Log.i("datagate", "Collection: " + eventInfo.getCollectionName() + " ErrorMessage: " + eventInfo.getError().getMessage() + " EventType: " + eventInfo.getEventType().toString());
                    }
                })
                .configure();

        // start sync in the background using handle
        syncHandle.startSync();

But after run the application i have this message logged:

I/datagate: Collection: Books ErrorMessage: NO2.11012: error while acquiring lock to remote collection EventType: REPLICATION_ERROR

I'm not sure if i'm using the right port (using 9090 give no response)
Also i will like to understand the relation between:

ENV DATAGATE_KEY_STORE "keystore.jks"
ENV DATAGATE_KEY_PASSWORD "s3cret"

I generated the keystore.jks field with the default configuration.

Thanks for your help!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions