Ekinlikler
Power BI DataViz Dünya Şampiyonası
14 Şub 16 - 31 Mar 16
4 giriş şansıyla bir konferans paketi kazanabilir ve Las Vegas'taki LIVE Grand Finale'e gidebilirsiniz
Daha fazla bilgi edininBu tarayıcı artık desteklenmiyor.
En son özelliklerden, güvenlik güncelleştirmelerinden ve teknik destekten faydalanmak için Microsoft Edge’e yükseltin.
Azure Communication Rooms is used to operate on rooms.
Source code | Package (Maven) | API reference documentation | Product documentation
If you want to take dependency on a particular version of the library that is not present in the BOM, add the direct dependency to your project as follows.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-communication-rooms</artifactId>
<version>1.1.8</version>
</dependency>
A DefaultAzureCredential
object must be passed to the RoomsClientBuilder
via the credential() function. Endpoint and httpClient must also be set via the endpoint() and httpClient() functions respectively.
AZURE_CLIENT_SECRET
, AZURE_CLIENT_ID
and AZURE_TENANT_ID
environment variables
are needed to create a DefaultAzureCredential object.
Alternatively, you can provide the entire connection string using the connectionString() function instead of providing the endpoint and access key.
// Find your connection string from your resource in the Azure Portal
String connectionString = "https://<resource-name>.communication.azure.com/;<access-key>";
RoomsClient roomsClient = new RoomsClientBuilder().connectionString(connectionString).buildClient();
Use the createRoom
function to create a new room.
OffsetDateTime validFrom = OffsetDateTime.now();
OffsetDateTime validUntil = validFrom.plusDays(30);
List<RoomParticipant> participants = new ArrayList<>();
// Add two participants
participant1 = new RoomParticipant(new CommunicationUserIdentifier("<ACS User MRI identity 1>")).setRole(ParticipantRole.ATTENDEE);
participant2 = new RoomParticipant(new CommunicationUserIdentifier("<ACS User MRI identity 2>")).setRole(ParticipantRole.CONSUMER);
participants.add(participant1);
participants.add(participant2);
// Create Room options
CreateRoomOptions roomOptions = new CreateRoomOptions()
.setValidFrom(validFrom)
.setValidUntil(validUntil)
.setParticipants(participants)
.setPstnDialOutEnabled(true);
CommunicationRoom roomResult = roomsClient.createRoom(roomOptions);
Use the updateRoom
function to update an existing room.
OffsetDateTime validFrom = OffsetDateTime.now();
OffsetDateTime validUntil = validFrom.plusDays(30);
// Update Room options
UpdateRoomOptions updateRoomOptions = new UpdateRoomOptions()
.setValidFrom(validFrom)
.setValidUntil(validUntil)
.setPstnDialOutEnabled(true);
try {
CommunicationRoom roomResult = roomsClient.updateRoom("<Room Id>", updateRoomOptions);
System.out.println("Room Id: " + roomResult.getRoomId());
} catch (RuntimeException ex) {
System.out.println(ex);
}
Use the getRoom
function to get an existing room.
try {
CommunicationRoom roomResult = roomsClient.getRoom("<Room Id>");
System.out.println("Room Id: " + roomResult.getRoomId());
} catch (RuntimeException ex) {
System.out.println(ex);
}
Use the deleteRoom
function to delete a created room.
try {
roomsClient.deleteRoom("<Room Id>");
} catch (RuntimeException ex) {
System.out.println(ex);
}
Use the list rooms
function to list all active rooms.
try {
PagedIterable<CommunicationRoom> rooms = roomsClient.listRooms();
for (CommunicationRoom room : rooms) {
System.out.println("Room ID: " + room.getRoomId());
}
} catch (Exception ex) {
System.out.println(ex);
}
Use the addOrUpdateParticipants
function to add or update participants in an existing room.
List<RoomParticipant> participantsToaddOrUpdate = new ArrayList<>();
// New participant to add
RoomParticipant participantToAdd = new RoomParticipant(new CommunicationUserIdentifier("<ACS User MRI identity 3>")).setRole(ParticipantRole.ATTENDEE);
// Existing participant to update, assume participant2 is part of the room as a
// consumer
participant2 = new RoomParticipant(new CommunicationUserIdentifier("<ACS User MRI identity 2>")).setRole(ParticipantRole.ATTENDEE);
participantsToaddOrUpdate.add(participantToAdd); // Adding new participant to room
participantsToaddOrUpdate.add(participant2); // Update participant from Consumer -> Attendee
try {
AddOrUpdateParticipantsResult addOrUpdateResult = roomsClient.addOrUpdateParticipants("<Room Id>", participantsToaddOrUpdate);
} catch (RuntimeException ex) {
System.out.println(ex);
}
Use the removeParticipants
function to remove participants from an existing room.
List<CommunicationIdentifier> participantsToRemove = new ArrayList<>();
participantsToRemove.add(participant1.getCommunicationIdentifier());
participantsToRemove.add(participant2.getCommunicationIdentifier());
try {
RemoveParticipantsResult removeResult = roomsClient.removeParticipants("<Room Id>", participantsToRemove);
} catch (RuntimeException ex) {
System.out.println(ex);
}
Use the listParticipants
function to list all participants from an existing room.
try {
PagedIterable<RoomParticipant> allParticipants = roomsClient.listParticipants("<Room Id>");
for (RoomParticipant participant : allParticipants) {
System.out.println(participant.getCommunicationIdentifier().getRawId() + " (" + participant.getRole() + ")");
}
} catch (RuntimeException ex) {
System.out.println(ex);
}
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Azure SDK for Java geri bildirimi
Azure SDK for Java, açık kaynak bir projedir. Geri bildirim sağlamak için bir bağlantı seçin:
Ekinlikler
Power BI DataViz Dünya Şampiyonası
14 Şub 16 - 31 Mar 16
4 giriş şansıyla bir konferans paketi kazanabilir ve Las Vegas'taki LIVE Grand Finale'e gidebilirsiniz
Daha fazla bilgi edinin