0
0
NestJSframework~10 mins

Microservice transports in NestJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the transport type for a microservice in NestJS.

NestJS
const microservice = app.connectMicroservice({ transport: Transport.[1] });
Drag options to blanks, or click blank then click option'
ATCP
BGRPC
CHTTP
DWEBSOCKET
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTP as a transport in microservice setup instead of TCP.
Confusing GRPC with TCP transport.
2fill in blank
medium

Complete the code to create a microservice client using Redis transport in NestJS.

NestJS
const client = ClientProxyFactory.create({ transport: Transport.[1], options: { url: 'redis://localhost:6379' } });
Drag options to blanks, or click blank then click option'
AREDIS
BTCP
CMQTT
DNATS
Attempts:
3 left
💡 Hint
Common Mistakes
Using TCP transport with Redis URL.
Confusing MQTT or NATS with Redis transport.
3fill in blank
hard

Fix the error in the microservice setup by selecting the correct transport option.

NestJS
app.connectMicroservice({ transport: Transport.[1] });
Drag options to blanks, or click blank then click option'
AHTTP
BTCP
CGRPC
DREDIS
Attempts:
3 left
💡 Hint
Common Mistakes
Using TCP or HTTP transport for gRPC microservices.
Misspelling the transport option.
4fill in blank
hard

Fill both blanks to configure a microservice with MQTT transport and specify the broker URL.

NestJS
app.connectMicroservice({ transport: Transport.[1], options: { url: '[2]' } });
Drag options to blanks, or click blank then click option'
AMQTT
Bredis://localhost:6379
Cmqtt://broker.hivemq.com
DTCP
Attempts:
3 left
💡 Hint
Common Mistakes
Using Redis URL with MQTT transport.
Using TCP transport with MQTT broker URL.
5fill in blank
hard

Fill all three blanks to create a client proxy with NATS transport, specify the URL, and set the queue name.

NestJS
const client = ClientProxyFactory.create({ transport: Transport.[1], options: { url: '[2]', queue: '[3]' } });
Drag options to blanks, or click blank then click option'
ANATS
Bnats://localhost:4222
Cmy_queue
Dmqtt://broker.hivemq.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using MQTT URL with NATS transport.
Omitting the queue name in options.