pip_services3_grpc 1.1.1 copy "pip_services3_grpc: ^1.1.1" to clipboard
pip_services3_grpc: ^1.1.1 copied to clipboard

This component library is a part of the [Pip.Services](https://github.com/pip-services/pip-services) project.It provides the following synchronous communication components.

example/main.dart

import 'package:pip_services3_commons/pip_services3_commons.dart';

import './DummyController.dart';
import './services/DummyCommandableGrpcService.dart';
import './clients/DummyCommandableGrpcClient.dart';
import './Dummy.dart';

var grpcConfig = ConfigParams.fromTuples([
  'connection.protocol',
  'http',
  'connection.host',
  'localhost',
  'connection.port',
  3002
]);

void main() async {
  DummyCommandableGrpcService service;
  DummyCommandableGrpcClient client;

  var ctrl = DummyController();

  service = DummyCommandableGrpcService();
  service.configure(grpcConfig);

  var references = References.fromTuples([
    Descriptor(
        'pip-services-dummies', 'controller', 'default', 'default', '1.0'),
    ctrl,
    Descriptor('pip-services-dummies', 'service', 'grpc', 'default', '1.0'),
    service
  ]);
  service.setReferences(references);
  await service.open('123');

  client = DummyCommandableGrpcClient();

  client.configure(grpcConfig);
  client.setReferences(References());
  await client.open('123');
//----------------------------------------------
  var dummy1 = Dummy(id: '', key: 'Key 1', content: 'Content 1');

  // Create one dummy
  var dummy = await client.createDummy('123', dummy1);

  // Get all dummies
  var dummies =
      await client.getDummies('123', FilterParams(), PagingParams(0, 5, false));

  // Update the dummy
  dummy!.content = 'Updated Content 1';
  dummy = await client.updateDummy('123', dummy);

  // Delete dummy
  await client.deleteDummy('123', dummy1.id!);

  // Try to get delete dummy
  dummy = await client.getDummyById('123', dummy1.id!);

//----------------------------------------------
  await client.close('123');
  await service.close('123');
}
0
likes
105
pub points
2%
popularity

Publisher

verified publisherentinco.com

This component library is a part of the [Pip.Services](https://github.com/pip-services/pip-services) project.It provides the following synchronous communication components.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

fixnum, grpc, pip_services3_commons, pip_services3_components, pip_services3_rpc, protobuf

More

Packages that depend on pip_services3_grpc