Giriş
Şu satırı dahil ederiz
import com.hazelcast.config.RestApiConfig;
DATA
Şu adreslere REST ile erişilebilir
Shttp://<member IP address>:<port>/hazelcast/rest/maps/mapName/key http://<member IP address>:<port>/hazelcast/rest/queues/queueName
Önemli bir açıklama şöyle
REST only really works with strings.So if you do a rest call /map/get/1234 the key will be interpreted as a String with the value "1234" and not an Integer or Long.
Örnek
Şöyle yaparız
RestApiConfig restApiConfig = new RestApiConfig().setEnabled(true).enableGroups(RestEndpointGroup.DATA);config.getNetworkConfig().setRestApiConfig(restApiConfig);
REST Server Socket'in 8080 dinlemesi için şöyle yaparız
<hazelcast>
...
<advanced-network enabled="true">
<rest-server-socket-endpoint-config>
<port auto-increment="false">8080</port>
...
</rest-server-socket-endpoint-config>
</advanced-network>
...
</hazelcast>key: foo ve value : bar olan bir girdi yaratmak için POST göndeririz. Şöyle yaparız.
curl -v -H "Content-Type: text/plain" -d "bar"
http://<member IP address>:<port>/hazelcast/rest/maps/mapName/foo#Get key : foo curl -X GET http://<member IP address>:<port>/hazelcast/rest/maps/mapName/foo < HTTP/1.1 200 OK < Content-Type: text/plain < Content-Length: 3 bar #Delete key : foo curl -v -X DELETE http://<member IP address>:<port>/hazelcast/rest/maps/mapName/foo < HTTP/1.1 200 OK < Content-Length: 0 #Delete all entries curl -v -X DELETE http://<member IP address>:<port>/hazelcast/rest/maps/mapName < HTTP/1.1 200 OK < Content-Length: 0
Hiç yorum yok:
Yorum Gönder