-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
6aca780
commit 3e90ef0
Showing
23 changed files
with
286 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import DaprClientBinding from './lib/GRPCClient/binding'; | ||
import DaprClientPubSub from './lib/GRPCClient/pubsub'; | ||
import DaprClientState from './lib/GRPCClient/state'; | ||
import DaprClientInvoker from './lib/GRPCClient/invoker'; | ||
import DaprClientSecret from './lib/GRPCClient/secret'; | ||
import DaprClientActor from './lib/GRPCClient/actor'; | ||
import GRPCClient from './lib/GRPCClient/GRPCClient'; | ||
|
||
export default class DaprClient { | ||
daprHost: string; | ||
daprPort: string; | ||
daprClient: GRPCClient; | ||
pubsub: DaprClientPubSub; | ||
state: DaprClientState; | ||
binding: DaprClientBinding; | ||
invoker: DaprClientInvoker; | ||
secret: DaprClientSecret; | ||
actor: DaprClientActor; | ||
|
||
constructor(daprHost: string, daprPort: string) { | ||
this.daprHost = daprHost || '127.0.0.1'; | ||
this.daprPort = daprPort || "5005"; | ||
|
||
this.daprClient = new GRPCClient(daprHost, daprPort); | ||
|
||
this.state = new DaprClientState(this.daprClient); | ||
this.pubsub = new DaprClientPubSub(this.daprClient); | ||
this.binding = new DaprClientBinding(this.daprClient); | ||
this.invoker = new DaprClientInvoker(this.daprClient); | ||
this.secret = new DaprClientSecret(this.daprClient); | ||
this.actor = new DaprClientActor(this.daprClient); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import DaprServerBinding from './lib/GRPCServer/binding'; | ||
import DaprServerPubSub from './lib/GRPCServer/pubsub'; | ||
import DaprServerInvoker from './lib/GRPCServer/invoker'; | ||
import DaprServerActor from './lib/GRPCServer/actor'; | ||
import GRPCServer from './lib/GRPCServer/GRPCServer'; | ||
|
||
export default class DaprServer { | ||
daprHost: string; | ||
daprPort: string; | ||
daprInternalServerPort: string; // The port for our app server (e.g. dapr binding receives, pubsub receive, ...)\ | ||
daprServer: GRPCServer; | ||
pubsub: DaprServerPubSub; | ||
binding: DaprServerBinding; | ||
invoker: DaprServerInvoker; | ||
actor: DaprServerActor; | ||
|
||
constructor(daprHost: string, daprPort: string, daprInternalServerPort: string = "50050") { | ||
this.daprHost = daprHost || '127.0.0.1'; | ||
this.daprPort = daprPort || "5005"; | ||
this.daprInternalServerPort = process.env.DAPR_INTERNAL_SERVER_PORT || daprInternalServerPort; | ||
this.daprServer = new GRPCServer(this.daprHost, this.daprInternalServerPort); | ||
|
||
// If DAPR_INTERNAL_SERVER_PORT was not set, we set it | ||
// This will be fetched by the GRPCServerSingleton | ||
process.env.DAPR_INTERNAL_SERVER_PORT = this.daprPort; | ||
|
||
// // Get the App Port as set in the Dapr constructor | ||
// const randomPort = Math.floor(Math.random() * (20000 - 10000 + 1)) + 10000; | ||
// const appPort = parseInt(process.env.DAPR_INTERNAL_SERVER_PORT || "", 10) || randomPort; | ||
|
||
this.pubsub = new DaprServerPubSub(this.daprServer); | ||
this.binding = new DaprServerBinding(this.daprServer); | ||
this.invoker = new DaprServerInvoker(this.daprServer); | ||
this.actor = new DaprServerActor(this.daprServer); | ||
} | ||
|
||
async startServer() { | ||
await this.daprServer.startServer(this.daprHost, this.daprInternalServerPort.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import Dapr from './Dapr'; | ||
import DaprClient from './DaprClient'; | ||
import DaprServer from './DaprServer'; | ||
|
||
import { Request as Req, Response as Res } from 'restana'; | ||
import { HttpMethod } from './enum/HttpMethod.enum'; | ||
import HttpStatusCode from './enum/HttpStatusCode.enum'; | ||
|
||
export default Dapr; | ||
|
||
export { | ||
HttpMethod, | ||
HttpStatusCode, | ||
Req, | ||
Res | ||
Res, | ||
DaprClient, | ||
DaprServer | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.