Tuesday, August 29, 2023

Docker Swarn

Docker is a tool intended to make the process of creating, deploying and running applications easier by using container based virtualization technology.

Docker is an open source container technology that provisions far more apps running on the same old servers compared to traditional VMs.

  • Create a Docker File -> Build Docker Image -> Verify Image -> Push to Repository 
  • Pull Image -> Run Service Using Image -> Verifying Running Service

Docker Engine

Docker engine is the Docker core component that is responsible for creating Docker Images and running them as services.

Docker Engine Core Components:  

Docker Daemon : Continuous running program (daemon process) that manages the service and other docker objects tied to it.

REST API : Specifies interfaces, that programs can utilize to speak to the daemon and direct it what to do.

Docker Client :  CLI is utilized to interact with the daemon (docker command).

Docker Networking :  The concept of networking in Docker comes into picture when working with Docker in a real time scenario at a large scale.

Docker Networking helps us to share data across various containers.

Host and containers in Docker are tied with 1:N relationship, which means one host can command multiple containers.

In this course, you will learn

  • What is Cluster Management system
  • What is Docker Swarm
  • Need for Docker Swarm and Key features
  • Swarm Architecture
  • Load Balancing, Service Discovery and High Availability
  • Swarm Networking and Security




Wednesday, July 5, 2023

Docker Knowledge

 in 2013, Docker hit the IT industry. It turned out to be a big hit with 13 billion + container image downloads per month in 2022. Increasing demand for docker showed an exponential increase in job openings. Go ahead and take advantage of all the new job openings with this article which lists down 50 most important Docker Interview Questions.

I have categorized these 50 questions into:

Docker Basic Questions

This category of Docker Interview Questions consists of questions that you’re expected to know. These are the most basic questions. An interviewer will start with these and eventually increase the difficulty level. Let’s have a look at them.

1. What is Hypervisor?

A hypervisor is a software that makes virtualization possible. It is also called Virtual Machine Monitor. It divides the host system and allocates the resources to each divided virtual environment. You can basically have multiple OS on a single host system. There are two types of Hypervisors:

  • Type 1: It’s also called Native Hypervisor or Bare metal Hypervisor. It runs directly on the underlying host system. It has direct access to your host’s system hardware and hence does not require a base server operating system.
  • Type 2: This kind of hypervisor makes use of the underlying host operating system. It’s also called Hosted Hypervisor.

2. What is virtualization?

Virtualization is the process of creating a software-based, virtual version of something(compute storage, servers, application, etc.). These virtual versions or environments are created from a single physical hardware system. Virtualization lets you split one system into many different sections which act like separate, distinct individual systems. A software called Hypervisor makes this kind of splitting possible. The virtual environment created by the hypervisor is called Virtual Machine.

3. What is containerization?

Let me explain this is with an example. Usually, in the software development process, code developed on one machine might not work perfectly fine on any other machine because of the dependencies. This problem was solved by the containerization concept. So basically, an application that is being developed and deployed is bundled and wrapped together with all its configuration files and dependencies. This bundle is called a container. Now when you wish to run the application on another system, the container is deployed which will give a bug-free environment as all the dependencies and libraries are wrapped together. Most famous containerization environments are Docker and Kubernetes.

4. Difference between virtualization and containerization

Once you’ve explained containerization and virtualization, the next expected question would be differences. The question could either be differences between virtualization and containerization or differences between virtual machines and containers. Either way, this is how you respond.

Containers provide an isolated environment for running the application. The entire user space is explicitly dedicated to the application. Any changes made inside the container is never reflected on the host or even other containers running on the same host. Containers are an abstraction of the application layer. Each container is a different application.

Whereas in Virtualization, hypervisors provide an entire virtual machine to the guest(including Kernal). Virtual machines are an abstraction of the hardware layer. Each VM is a physical machine.

5. What is Docker?

Since its a Docker interview, there will be an obvious question about what is Docker. Start with a small definition.

Docker is a containerization platform which packages your application and all its dependencies together in the form of containers so as to ensure that your application works seamlessly in any environment, be it development, test or production. Docker containers, wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries, etc. It wraps basically anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

6. What is a Docker Container?

Docker containers include the application and all of its dependencies. It shares the kernel with other containers, running as isolated processes in user space on the host operating system. Docker containers are not tied to any specific infrastructure: they run on any computer, on any infrastructure, and in any cloud. Docker containers are basically runtime instances of Docker images.

7. What are Docker Images?

When you mention Docker images, your very next question will be “what are Docker images”.

Docker image is the source of Docker container. In other words, Docker images are used to create containers. When a user runs a Docker image, an instance of a container is created. These docker images can be deployed to any Docker environment.

8. What is Docker Hub?

Docker images create docker containers. There has to be a registry where these docker images live. This registry is Docker Hub. Users can pick up images from Docker Hub and use them to create customized images and containers. Currently, the Docker Hub is the world’s largest public repository of image containers.

9. Explain Docker Architecture?

Docker Architecture consists of a Docker Engine which is a client-server application with three major components:

  1. A server which is a type of long-running program called a daemon process (the docker command).
  2. A REST API which specifies interfaces that programs can use to talk to the daemon and instruct it what to do.
  3. A command line interface (CLI) client (the docker command).
  4. The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands. Many other Docker applications use the underlying API and CLI.


10. What is a Dockerfile?

Let’s start by giving a small explanation of Dockerfile and proceed by giving examples and commands to support your arguments.

Docker can build images automatically by reading the instructions from a file called Dockerfile. A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build, users can create an automated build that executes several command-line instructions in succession.

The interviewer does not just expect definitions, hence explain how to use a Dockerfile which comes with experience. Have a look at this tutorial to understand how Dockerfile works.

11. Tell us something about Docker Compose.

Docker Compose is a YAML file which contains details about the services, networks, and volumes for setting up the Docker application. So, you can use Docker Compose to create separate containers, host them and get them to communicate with each other. Each container will expose a port for communicating with other containers.

12. What is Docker Swarm?

You are expected to have worked with Docker Swarm as it’s an important concept of Docker.

Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single, virtual Docker host. Docker Swarm serves the standard Docker API, any tool that already communicates with a Docker daemon can use Swarm to transparently scale to multiple hosts.

13. What is a Docker Namespace?

A namespace is one of the Linux features and an important concept of containers. Namespace adds a layer of isolation in containers. Docker provides various namespaces in order to stay portable and not affect the underlying host system. Few namespace types supported by Docker – PID, Mount, IPC, User, Network

14. What is the lifecycle of a Docker Container?

This is one of the most popular questions asked in Docker interviews. Docker containers have the following lifecycle:

  • Create a container
  • Run the container
  • Pause the container(optional)
  • Un-pause the container(optional)
  • Start the container
  • Stop the container
  • Restart the container
  • Kill the container
  • Destroy the container

15. What is Docker Machine?

Docker machine is a tool that lets you install Docker Engine on virtual hosts. These hosts can now be managed using the docker-machine commands. Docker machine also lets you provision Docker Swarm Clusters.

Docker Basic Commands

Once you’ve aced the basic conceptual questions, the interviewer will increase the difficulty level. So let’s move on to the next section of this Docker Interview Questions article. This section talks about the commands that are very common amongst docker users.

16. How to check for Docker Client and Docker Server version?

The following command gives you information about Docker Client and Server versions:

$ docker version

17. How do you get the number of containers running, paused and stopped?

You can use the following command to get detailed information about the docker installed on your system.

$ docker info


You can get the number of containers running, paused, stopped, the number of images and a lot more.

18. If you vaguely remember the command and you’d like to confirm it, how will you get help on that particular command?

The following command is very useful as it gives you help on how to use a command, the syntax, etc.

$ docker --help

The above command lists all Docker commands. If you need help with one specific command, you can use the following syntax:

$ docker <command> --help

19. How to login into docker repository?

You can use the following command to login into hub.docker.com:

$ docker login

You’ll be prompted for your username and password, insert those and congratulations, you’re logged in.

20. If you wish to use a base image and make modifications or personalize it, how do you do that?

You pull an image from docker hub onto your local system

It’s one simple command to pull an image from docker hub:

$ docker pull <image_name>

21. How do you create a docker container from an image?

Pull an image from docker repository with the above command and run it to create a container. Use the following command:

$ docker run -it -d <image_name>

Most probably the next question would be, what does the ‘-d’ flag mean in the command?

-d means the container needs to start in the detached mode. Explain a little about the detach mode. Have a look at this blog to get a better understanding of different docker commands.

22. How do you list all the running containers?

The following command lists down all the running containers:

$ docker ps

23. Suppose you have 3 containers running and out of these, you wish to access one of them. How do you access a running container?

The following command lets us access a running container:

$ docker exec -it <container id> bash

The exec command lets you get inside a container and work with it.

24. How to start, stop and kill a container?

The following command is used to start a docker container:

$ docker start <container_id>

and the following for stopping a running container:

$ docker stop <container_id>

kill a container with the following command:

$ docker kill <container_id>

25. Can you use a container, edit it, and update it? Also, how do you make it a new and store it on the local system?

Of course, you can use a container, edit it and update it. This sounds complicated but its actually just one command.

$ docker commit <conatainer id> <username/imagename>

26. Once you’ve worked with an image, how do you push it to docker hub?

$ docker push <username/image name>

27. How to delete a stopped container?

Use the following command to delete a stopped container:

$ docker rm <container id>

DevOps Training

28. How to delete an image from the local storage system?

The following command lets you delete an image from the local system:

$ docker rmi <image-id>

29. How to build a Dockerfile? 

Once you’ve written a Dockerfile, you need to build it to create an image with those specifications. Use the following command to build a Dockerfile:

$ docker build <path to docker file>

The next question would be when do you use “.dockerfile_name” and when to use the entire path?

Use “.dockerfile_name” when the dockerfile exits in the same file directory and you use the entire path if it lives somewhere else.

30. Do you know why docker system prune is used? What does it do?

$ docker system prune

The above command is used to remove all the stopped containers, all the networks that are not used, all dangling images and all build caches. It’s one of the most useful docker commands.

Docker Advanced Questions

Once the interviewer knows that you’re familiar with the Docker commands, he/she will start asking about practical applications This section of Docker Interview Questions consists of questions that you’ll only be able to answer when you’ve gained some experience working with Docker.

31. Will you lose your data, when a docker container exists?

No, you won’t lose any data when Docker container exits. Any data that your application writes to the container gets preserved on the disk until you explicitly delete the container. The file system for the container persists even after the container halts.

32. Where all do you think Docker is being used?

When asked such a question, respond by talking about applications of Docker. Docker is being used in the following areas:

  • Simplifying configuration: Docker lets you put your environment and configuration into code and deploy it.
  • Code Pipeline Management: There are different systems used for development and production. As the code travels from development to testing to production, it goes through a difference in the environment. Docker helps in maintaining the code pipeline consistency.
  • Developer Productivity: Using Docker for development gives us two things – We’re closer to production and development environment is built faster.
  • Application Isolation: As containers are applications wrapped together with all dependencies, your apps are isolated. They can work by themselves on any hardware that supports Docker.
  • Debugging Capabilities: Docker supports various debugging tools that are not specific to containers but work well with containers.
  • Multi-tenancy: Docker lets you have multi-tenant applications avoiding redundancy in your codes and deployments.
  • Rapid Deployment: Docker eliminates the need to boost an entire OS from scratch, reducing the deployment time.

33. How is Docker different from other containerization methods?

Docker containers are very easy to deploy in any cloud platform. It can get more applications running on the same hardware when compared to other technologies, it makes it easy for developers to quickly create, ready-to-run containerized applications and it makes managing and deploying applications much easier. You can even share containers with your applications.

If you have some more points to add you can do that but make sure the above explanation is there in your answer.

34. Can I use JSON instead of YAML for my compose file in Docker?

You can use JSON instead of YAML for your compose file, to use JSON file with compose, specify the JSON filename to use, for eg:

$ docker-compose -f docker-compose.json up

35. How have you used Docker in your previous position?

Explain how you have used Docker to help rapid deployment. Explain how you have scripted Docker and used it with other tools like Puppet, Chef or Jenkins. If you have no past practical experience in Docker and instead have experience with other tools in a similar space, be honest and explain the same. In this case, it makes sense if you can compare other tools to Docker in terms of functionality.

36. How far do Docker containers scale? Are there any requirements for the same?

Large web deployments like Google and Twitter and platform providers such as Heroku and dotCloud, all run on container technology. Containers can be scaled to hundreds of thousands or even millions of them running in parallel. Talking about requirements, containers require the memory and the OS at all the times and a way to use this memory efficiently when scaled.

37. What platforms does docker run on?

This is a very straightforward question but can get tricky. Do some company research before going for the interview and find out how the company is using Docker. Make sure you mention the platform company is using in this answer.

Docker runs on various Linux administration:

  • Ubuntu 12.04, 13.04 et al
  • Fedora 19/20+
  • RHEL 6.5+
  • CentOS 6+
  • Gentoo
  • ArchLinux
  • openSUSE 12.3+
  • CRUX 3.0+

It can also be used in production with Cloud platforms with the following services:

  • Amazon EC2
  • Amazon ECS
  • Google Compute Engine
  • Microsoft Azure
  • Rackspace

38. Is there a way to identify the status of a Docker container?

There are six possible states a container can be at any given point – Created, Running, Paused, Restarting, Exited, Dead.

Use the following command to check for docker state at any given point:

$ docker ps

The above command lists down only running containers by default. To look for all containers, use the following command:

$ docker ps -a

39. Can you remove a paused container from Docker?

The answer is no. You cannot remove a paused container. The container has to be in the stopped state before it can be removed.

40. Can a container restart by itself?

No, it’s not possible for a container to restart by itself. By default the flag -restart is set to false.

41. Is it better to directly remove the container using the rm command or stop the container followed by remove container?

Its always better to stop the container and then remove it using the remove command.

$ docker stop <coontainer_id>
$ docker rm -f <container_id>

Stopping the container and then removing it will allow sending SIG_HUP signal to recipients. This will ensure that all the containers have enough time to clean up their tasks. This method is considered a good practice, avoiding unwanted errors.

42. Will cloud overtake the use of Containerization?

Docker containers are gaining popularity but at the same time, Cloud services are giving a good fight. In my personal opinion, Docker will never be replaced by Cloud. Using cloud services with containerization will definitely hype the game. Organizations need to take their requirements and dependencies into consideration into the picture and decide what’s best for them. Most of the companies have integrated Docker with the cloud. This way they can make the best out of both the technologies.

43. How many containers can run per host?

There can be as many containers as you wish per host. Docker does not put any restrictions on it. But you need to consider every container needs storage space, CPU and memory which the hardware needs to support. You also need to consider the application size. Containers are considered to be lightweight but very dependant on the host OS.

44. Is it a good practice to run stateful applications on Docker?

The concept behind stateful applications is that they store their data onto the local file system. You need to decide to move the application to another machine, retrieving data becomes painful. I honestly would not prefer running stateful applications on Docker.


45. Suppose you have an application that has many dependant services. Will docker compose wait for the current container to be ready to move to the running of the next service?

The answer is yes. Docker compose always runs in the dependency order. These dependencies are specifications like depends_on, links, volumes_from, etc.

46. How will you monitor Docker in production?

Docker provides functionalities like docker stats and docker events to monitor docker in production. Docker stats provides CPU and memory usage of the container. Docker events provide information about the activities taking place in the docker daemon.

47. Is it a good practice to run Docker compose in production?

Yes, using docker compose in production is the best practical application of docker compose. When you define applications with compose, you can use this compose definition in various production stages like CI, staging, testing, etc.

48. What changes are expected in your docker compose file while moving it to production?

These are the following changes you need make to your compose file before migrating your application to the production environment:

  • Remove volume bindings, so the code stays inside the container and cannot be changed from outside the container.
  • Binding to different ports on the host.
  • Specify a restart policy
  • Add extra services like log aggregator

49. Have you used Kubernetes? If you have, which one would you prefer amongst Docker and Kubernetes?

Be very honest in such questions. If you have used Kubernetes, talk about your experience with Kubernetes and Docker Swarm. Point out the key areas where you thought docker swarm was more efficient and vice versa. Have a look at this blog for understanding differences between Docker and Kubernetes.

You Docker interview questions are not just limited to the workarounds of docker but also other similar tools. Hence be prepared with tools/technologies that give Docker competition. One such example is Kubernetes.

50. Are you aware of load balancing across containers and hosts? How does it work?

While using docker service with multiple containers across different hosts, you come across the need to load balance the incoming traffic. Load balancing and HAProxy is basically used to balance the incoming traffic across different available(healthy) containers. If one container crashes, another container should automatically start running and the traffic should be re-routed to this new running container. Load balancing and HAProxy works around this concept.

This brings us to the end of the Docker Interview Questions article. With increasing business competition, companies have realized the importance of adapting and taking advantage of the changing market. Few things that kept them in the game were faster scaling of systems, better software delivery, adapting to new technologies, etc. That’s when docker swung into the picture and gave these companies boosting support to continue the race.


IBM MQ Interview Question

 

IBM WebSphere Message Queue Interview Questions and Answers

1. What exactly do you understand with the term MQ and what it is responsible for?

MQ abbreviates Message Queuing. When it comes to message-driven processes, IBM enables users to simply keep up the pace with the WebSphere with which all application programs can simply be managed. There is no strict upper limit on the platforms when it comes to communicating and the good thing is vast support is available from IBM to enable the users to manage everything simply. 

2. What are the benefits that corporations can have through IBM Websphere MQ

Organizations and corporations can simply send bulk messages over complex networks. There are no strict protocols that need to be followed. Even if they are, the same can be managed very easily. Enterprises can make sure of quick information delivery to the destinations and can always have the things done in the best possible manner. 

3. Suppose you need to install the IBM Websphere MQ in Aix, what would be the requirements related to the software you need to fulfill?

The one and the only prime requirement is the machine should be of 32-bit OS. Although it works on 64-bit OS, it needs some customized settings. The Aix should be installed on it and there will be no corrupt files related to programming. 

4. What do you know about the Message Driven Process?

A lot of messages arrive at the queue and especially when there is a lot of traffic. When such a thing happens, an automatic process that relates to the triggering starts. It is possible to stop the application with a simple instruction after it has done its work. 

5. Is it possible that an MQSC command has multiple parameters?

Yes, it can be possible. 

6. Is there any limit on the message length supported by the MQ in WebSphere?

Ans: Generally, the default length of a message is 4MB. However, it is not always necessary that all the messages should be of this size. In some special cases, it can be up to 100 MB. In case a message is too large in terms of size, the same can be divided into different parts and then these parts are sent in sequence order. This approach is generally regarded as message switching. 

7. In IBM WebSphere MQ, how you will define a message?

A message is basically considered as a string of bytes that contains something useful for the machine or for the user. Generally, messages are deployed when it comes to sharing information among different nodes. It doesn’t matter whether the application runs on platforms that are different from each other. 


8. Can you name an attribute that is used to check the exact length of a message?

This is “MaxMsgLength”

9. Does IBM Websphere MQ support Integration, if so, how can you say this?

Well, the fact is IBM Websphere MQ is totally independent of the OS one is using. The same factor makes it totally independent of the TCP/IP protocol as well. There are many instances when the messages don’t get delivered or get delayed just because of a sender and a receiver having an OS mismatch. This is actually not at all a big deal with the IBM Websphere MQ and users need not worry about anything related to this. 

10. Is it possible for the IBM Websphere MQ to support the WebSphere MQ applications which are local?

Yes, it is possible. 

11. What is packet lost in Messaging and how the receiver knows which packet is not received by it?

Packets are the sub-parts of a message that needs to be sent from a sender to a receiver. Sometimes a situation arrives when a packet doesn’t reach its destination. Because all the packets have a well-defined address on them, the receiver can understand and acknowledge which message has been lost. 

12. What do you mean by Asynchrony in IBM Websphere MQ?

In the queue process, the process of sending or exchange of any message doesn’t depend on the time. This is exactly what makes both the sender, as well as the receiver be decoupled if the need for the same is there. There is actually no need for the sender to wait for getting the acknowledgment regarding the delivery of the message from the receiver. IT can continue with this next task. This process is basically considered as Asynchrony in IBM Websphere MQ. 

13. Tell us about the storage needs when it comes to IBM Websphere MQ installation

The installation of IBM Websphere MQ needs to have some basic storage requirements which are as under. 

It needs 50 MB for data storage on the server. The server installation needs around 40 MB. While the data storage for the client and the installation of the file at the client end have 5 MB and 15 MB needs. 

14. Is the procedure of installation of the IBM WebSphere MQ on Aix similar to that for Windows?

Yes, all the requirements are the same except for a few basic ones. For older versions of Windows such as 2000 and XP, it needs some customized settings in the application. It is actually free from the network protocols and thus users have no reasons to worry about this. 

15. What do you know about persistent and non-persistent messages?

In WebSphere MQ two types of messages exist. They are basically classified based on priority. The messages which are urgent and should be recovered in all the circumstances are called persistent messages. Others are non-persistent messages. This clearly indicates that persistent messages are always delivered to the destination. Users can define any message as persistent. It should be kept in mind that there is a limit on the number of attempts that the sender makes for the delivery in case anything goes wrong. 

16. What do you mean by the Application data in the IBM Websphere MQ message?

It is necessary to define the structure of an application data that needs to be used in a message. Applications programs make sure of this and this practice is followed in all the messages. This data is generally considered as application data. 

17. What do you mean by message descriptor?

A massage doesn’t just contain information that needs to be transferred but it contains other information too. For example, the type of message and what exactly its priority is. The same is described in the message descriptor which is defined by WebSphere MQ. It contains all other relevant information about the message and among all of the same, its priority that largely matters. 

18. Suppose you need to create the names of the MQ objects, what would be the number of characters that are required by you?

All MQ channels should be within the 20 characters maximum and all other objects can have up to 48 characters. They need to be created into parts if this limit exceeds due to any reason. 

19. In message switching, what is the sub-part of a message is called? What if it gets lost?

They are known as packets and packets in most of the cases are having the same size. Because they all belong to the same message, the information format is similar. They can choose any path that exists between the sender and the receiver and this is exactly what can sometimes result in packet loss. Although its priority is very low, in case it happens, the receiver can send the acknowledgment to the sender that it has not received a specific packet. The sender then has to resend the same to it. 

20. Name the default port number for the MQ Queue Manager. Is it possible to change this?

The default number is 1414 and the same cannot be changed. 

21. What do you understand by the term congestion control?

Well, the fact is sometimes there are so many messages on a network. The channel has its own limit of processing the data and when the same exceeds, the situation is considered as congestion. It is similar to a traffic jam on a road. The clearance needs time and so do the messages get a bit delayed for delivery. 

22. In IBM Websphere MQ, what is an MQ client, and how it is different from an MQ server?

Many times there is a need to issue MQI calls to a queue manager. IT is not always necessary that it runs on the same system. MQ client is responsible for issuing the same for an application. The output can be modified up to some extent. On the other side, the MQ server is basically a manager for the queue which is responsible for offering the queuing service to the clients. All the objects which are classified in the MQ appear only on the server and not on the client’s machine. 

23. Name the different objects that are used in the WebSphere MQ?

These are Channels, Processes, Queue Manager, Name Lists, and Processes.

All these objects can have a similar nature or a different one depending on the operation they are engaged in.

24. What is the concept of switching?

Ans: Ina network, there can be a very large number of nodes. Practically it is not possible to establish a direct physical connection between them all. Of course, this can enhance the cost up to a great extent and can make the network very complex. Thus, the concept of switching is considered. It basically acts as a temporary path that is established between a sender and a receiver for message transfer. The connection is terminated after the message is sent. Because not all the nodes need channels all the time, this concept can be applied. It is having a lot of advantages. All the data that seems to be sent on priority can be assigned sent immediately by stopping other operations. 

25. What is the difference between the control commands and the MQS commands?

Control commands are used when it comes to managing the services, as well as different processes related to messaging. Most of the time, these commands are deployed for the channel listener, triggering or for the integration of the same. On the other side, the MQS commands are useful when it comes to functions that are related to the tasks performed by an administrator. It is also possible to create Queue Managers and channels through these commands. 

26. Name some script commands and tell one basic condition for their use?

These are:

  1. ALTER
  2. START
  3. STOP
  4. DELETE
  5. CLEAR
  6. DEFINESUSPEND
  7. REFRESH
  8. RESUME

It is necessary that they are used in capital letters otherwise there will be no response. 

27. Mention the top features of MQ you are already familiar with?

Well, they are Assured Delivery, Integration, Scalability, and Asynchrony
Although in few cases it consumes time depending on the exact message in the queue, the delivery is always assured. Users can check the status of all the messages simply anytime they want. 

28. After creating the Queue Manager, where you can find the Backup files? Can its location be changed?

The same is present in a folder which is named Windows Registry and is present in the Window’s Program Files. Yes, it is possible to change its location and users can store the backup data anywhere they want.

29. What are the Telemetry capabilities you are familiar with?

Telemetry allows the remote sensors to be connected with a node. When it comes to optimizing the sensor networks, its telemetry provides an optimization technique. In satellite networks, it can help to save a lot of costs simply. 

30. What exactly do you know about the MQ series?

It can hold messages in multiple formats
Maintaining the objects like channels and Queues is their responsibility
It is possible to define the queues in the JEE container simply with the help of this series

31. What is MQ and what does it do?

MQ stands for MESSAGE QUEUEING. WebSphere MQ allows application programs to use message queuing to participate in message-driven processing. Application programs can communicate across different platforms by using the appropriate message queuing software products.

32. What is a Message-driven process?

When messages arrive on a queue, they can automatically start an application using triggering. If necessary, the applications can be stopped when the message (or messages) have been processed.

33. What are the advantages of the MQ?

  1. Integration
  2. Asynchrony
  3. Assured Delivery
  4. Scalability

34. How does it support Integration?

Because the MQ is independent of the Operating System you use i.e. it may be Windows, Solaris, AIX.It is independent of the protocol (i.e. TCP/IP, LU6.2, SNA, NetBIOS, UDP). It is not required that both the sender and receiver should be running on the same platform


35. What is Asynchrony?

With message queuing, the exchange of messages between the sending and receiving programs is independent of time. This means that the sending and receiving application programs are decoupled; the sender can continue processing without having to wait for the receiver to acknowledge receipt of the message. The target application does not even have to be running when the message is sent. It can retrieve the message after it is has been started.

36. What are the hardware and software requirements for MQ Installation in AIX?

WebSphere MQ for AIX, V5.3 runs on any machine that supports the AIX V4.3.3 PowerPC® 32.bit, or AIX® V5.1 Power 32 bit only operating system.

Disk Storage: Typical storage requirements are as follows:

  1. Server installation: 50 MB
  2. Client installation: 15 MB
  3. Data storage (server): 50 MB
  4. Data storage (client): 5 MB

Software Requirements:

Operating system: The operating systems supported by WebSphere MQ for AIX, V5.3 are:

  1. AIX V4.3.3, with PTF U472177, running in a 32-bit environment, on 32 or 64-bit hardware.
  2. AIX V5.1, with PTFs U476879, U477366, U477367, and U477368, and APAR fix IY29345 running 32-bit kernel running on 32 or 64-bit hardware.
  3. AIX V5.1, with PTF U476879, U477366, U477367, and U477368, and APAR fix IY29345 running 64-bit kernel running on 64-bit hardware.

Connectivity The network protocols supported by WebSphere MQ for AIX, V5.3 are:

  1. TCP/IP
  2. SNA LU 6.2.
  • Databases: DB2 7.1, 7.2
  • Oracle 8i and 9i
  • Sybase v12 or v 12.5
  • Java: If you want to use the Java Messaging Support, you need the Java Runtime Environment Version 1.3 or later

37. What are the software and hardware requirements for installing MQ on Windows?

MQ v 5.3 supports Windows 2000, Windows 2000XP,Windows 2000NT,
Windows 2003 SE, Windows 2003EE.

Disk Storage: Typical storage requirements are as follows:

  1. Server installation: 50 MB
  2. Client installation: 15 MB
  3. Data storage (server): 50 MB
  4. Data storage (client): 5 MB.

Connectivity The network protocols supported by WebSphere MQ for AIX, V5.3 are:

  1. TCP/IP
  2. SNA LU 6.2.
  3. LU 6.2
  4. NetBIOS
  • Databases: DB2 7.1, 7.2
  • Oracle 8i and 9i
  • Sybase v12 or v 12.5
  • Java: If you want to use the Java Messaging Support, you need the Java Runtime Environment Version 1.3 or later

38. What is a Message and what does it contain?

A message is a string of bytes that is meaningful to the applications that use it. Messages are used to transfer information from one application program to another (or between different parts of the same application). The applications can be running on the same platform, or on different platforms.

WebSphere MQ messages have two parts:

  1. The application data. The content and structure of the application data are defined by the application programs that use it.
  2. A message descriptor. The message descriptor identifies the message and contains additional control information, such as the type of message and the priority assigned to the message by the sending application. WebSphere MQ defines the format of the message descriptor. For a complete description of the message descriptor.

39. What is the Max Length of the message does MQ support?

The default maximum message length is 4 MB, although you can increase this to a maximum length of 100 MB (where 1 MB equals 1 048 576 bytes).

40. What is the difference between Persistent and Non Persistent Messages?

In Web Sphere MQ, messages can be either persistent or nonpersistent. Persistent messages are logged and can be recovered in the event of a WebSphere MQ failure. Thus, persistent messages are guaranteed to be delivered once and only once. Nonpersistent messages are not logged. Web Sphere still guarantees to deliver them not more than once, but it does not promise to deliver them once.

41. What is the effect of using Persistent messages?

Persistent messages are usually logged. Logging messages reduces the performance of your application, so use persistent messages for essential data only. If the data in a message can be discarded if the queue manager stops or fails, use a nonpersistent message.

WebSphere MQ messages:

Messages are made up of two parts: Message descriptor, Application data

42. Types of messages?

  • Datagram: A Message sent with no response expected.
  • Request: A Message sent for which a response is expected.
  • Reply Response Message for a requested message.
  • Report: A Message that describes the occurrence or event
  • Ex COA/COD

43. Sizes?

Qmanagerà10000 Msgs Maxmsglengthà4 Mb
Queueà5000 Msgs Maxmsglengthà4 Mb

44. What is the attribute used to see the Message length?

MaxMsgLength

45. What is MQ Client?

A Web Sphere MQ client is a component that allows an application running on a system to issue MQI calls to a queue manager running on another system. The output from the call is sent back to the client, which passes it back to the application.

46. What is MQ Server?

A Web Sphere MQ server is a queue manager that provides queuing services to one or more clients. All the Web Sphere MQ objects, for example, queues, exist only on the queue manager machine (the Web Sphere MQ server machine), and not on the client. A Web Sphere MQ server can also support local Web Sphere MQ Applications

47. What are the Objects used in Web sphere MQ?

  1. Queue Manager
  2. Queues
  3. Channels
  4. Processes
  5. Name lists.

48. Mention the No of Characters required for creating names of the MQ objects?

For MQ Channels it is 20 Characters
For the Remaining objects, it is 48 characters.

49. What about is the Default port number for MQ Queue Manager?

1414

50. Difference between MQSC commands and Control commands?

MQSC Commands – These commands are used to handle the admin-related functions for the components that are present in the MQ Series. In general MQSC commands are used for creating and maintaining Message channels, Queue Managers, Clusters, etc…

Control Commands – These commands are used to manage the processes and services that are helpful in the functioning of the MQ Series. In general, these commands are used for Channel listener, Channel Initiator, Trigger monitor, etc…

51. Is the MQSC attributes are Case sensitive?

MQSC commands, including their attributes, can be written in uppercase or lowercase. Object names in MQSC commands are folded to uppercase (that is, QUEUE and queue are not differentiated) unless the names are enclosed within single quotation marks. If quotation marks are not used, the object is processed with a name in uppercase.

SCRIPT COMMANDS

After entering into the queue manager we can find script commands.

Script commands are the same for every queue manager.

(These Commands should be used in CAPITAL LETTERS)

  1. DEFINE: To define/create MQ manager objects like a queue, Channels, process, and listener.
  2. ALTER: to update or modify the existing objects
  3. DISPLAY: to view all the properties of a particular object or to Display all objects
  4. DELETE: to delete created objects
  5. CLEAR: to clear the message from the queue
  6. END: to come out of the queue manager
  7. PING: to check whether the other side-channel / queue manager is ready to accept our request.
  8. START: to start the particular channel or listener
  9. STOP: to stop a particular channel or listener
  10. REFRESH: used to refresh the security every time after giving or executing, set mgr or command for queue manager or object
  11. RESET: used to reset channel, cluster, queue manager
  12. RESOLVE: to resolve the channel which is in an in-doubt state
  13. SUSPEND: to suspend a queue manager from a cluster environment
  14. RESUME: to remove a queue manager from a cluster environment

52. How can we write the MQSC commands that have too many parameters?

For commands that have too many parameters to fit on one line, use continuation characters to indicate that a command is continued on the following line:

  1. A minus sign ( ) indicates that the command is to be continued from the start of _ the following line.
  2. A plus sign (+) indicates that the command is to be continued from the first nonblank character on the following line.

53. What are programmable command format (PCF) commands?

These commands are issued from a program for local or remote administration done by programmers.

54. What are commands used for creating the Queue manager from the Command prompt?

crtmqm -q -d MY.DEFAULT.XMIT.QUEUE -u DEAD.LETTER.QUEUE QM1

Here -q used to define the Queue manager QM1 as a Default Queue manager

-d is used to define the default transmission Queue -u is used to defining the default dead letter queue.

55.  How can U make the existing Queue Manager a default Queue Manager?

On Windows systems, use the Web Sphere MQ Services snap-in to display the properties of the queue manager, and check the Make queue manager in the default box. You need to stop and restart the queue manager for the change to take effect.

56. Where are the backup files are present after creating the Queue Manager?

Windows systems: If you use Web Sphere MQ for Windows NT and Windows 2000, configuration information is stored in the Windows Registry.
UNIX Systems:

  1. When you install the product, the Web Sphere MQ configuration file (mqs.ini) is created. It contains a list of queue managers that is updated each time you create or delete a queue manager. There is one mqs.ini file per node.
  2. When you create a new queue manager, a new queue manager configuration file (qm.ini) is automatically created. This contains configuration parameters for the queue manager.

57. What is the command used for starting the Queue Manager?

strmqm QMName

58. What is the command used for stopping the Queue manager?

endmqm -w QMName
The command waits until all applications have stopped and the queue manager has ended.

endmqm –I QMName
This type of shutdown does not wait for applications to disconnect from the queue manager.

59. What’s the message code for Stopping a Queue Manager?

AMQ4044 Queue manager stopping


60. What is the command used to delete the QueueManager?

dltmqm QMName

61. Display the attributes of the Queue Manager QM1?

runmqsc QM1 Display qmgr

62. Identification/Authorization

I have an IBM Websphere MQ v6.0 queue manager running on Solaris 9. I want to prevent my staff members who have limited WebSphere MQ experience to make changes to the WMQ network.

63. Is there a way to do this?

One way is to use Dale Lane’s “Using WebSphere MQ Explorer as a read-only viewer”:

The WebSphere MQ Explorer GUI provides a user-friendly way to administer your queue managers. It can be used as a read-only ‘viewer’. If you have some staff that doesn’t have authority to make changes to the WMQ network but needs them to be able to monitor what is happening, this would let them use WMQ Explorer to do it.

The following are the steps required to set this up for a single queue manager and highlight a couple of potential problems to watch out for.

Steps to carry out on the machine hosting the queue manager:

  1. Create a user – making sure that the user is not a member of the MQM group.
  2. Start a channel listener for the queue manager.
  3. Create a server-connection (SVRCONN) channel on the queue manager – setting the MCAUSER attribute to the user name defined in step 1.
  4. Use setmqaut to specify which objects you want the user to be able to see.
  5. First, you need permission to connect to the queue manager:
    setmqaut -m YOUR_QUEUE_MANAGER -t qmgr -p YOUR_USER_NAME +connect +inq +dsp
    Next is to give permission to the queues that WMQ Explorer will need:
    setmqaut -m YOUR_QUEUE_MANAGER -t q -n SYSTEM.DEFAULT.MODEL.QUEUE -p YOUR_USER_NAME +get +browse +inq
    setmqaut -m YOUR_QUEUE_MANAGER -t q -n SYSTEM.ADMIN.COMMAND.QUEUE -p YOUR_USER_NAME +get +browse +inq +put
    setmqaut -m YOUR_QUEUE_MANAGER -t q -n SYSTEM.MQEXPLORER.REPLY.MODEL -p YOUR_USER_NAME +inq +browse +get +dsp
    setmqaut -m YOUR_QUEUE_MANAGER -t q -n ‘AMQ.**’ -p YOUR_USER_NAME +all
    setmqaut -m YOUR_QUEUE_MANAGER -t q -n ‘MQAI.**’ -p YOUR_USER_NAME +all
    Then, you could give access to all objects of a certain type, such as being able to display all channels:
    setmqaut -m YOUR_QUEUE_MANAGER -t channel -n ‘**’ -p YOUR_USER_NAME +dsp
    You might want to include additional permissions, such as the ability to browse messages on queues or inquire about their attributes:
    setmqaut -m YOUR_QUEUE_MANAGER -t q -n ‘**’ -p YOUR_USER_NAME +dsp +inq +browse
    Review the System Administration Guide section on setmqaut for more detail on the options available.

Steps to carry out on the WebSphere MQ Explorer machine:

Right-click on ‘Queue Managers’ and choose “Show Queue Manager”

  1. Click on the “Add” button
  2. Enter the queue manager name and click “Next”
  3. Fill in the hostname of the machine hosting the queue manager, the TCP port number for the channel listener you started, and the name of the server-connection channel you created.
  4. Click “Finish”

Things to watch out for:

Note 1: The WebSphere MQ Explorer user will only see the objects that they have the authority to see. So it’s worth being aware that in such a setup, the Explorer is no longer showing a definitive view of the objects on the queue manager.

Note 2: Attempts to view an object, which the user isn’t authorized to display, can result in an authorization event. See the Monitoring WebSphere MQ section on ‘Event Monitoring’

(fhttps://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzax.doc/monevent.htm) for more information. To summarize, if a queue manager has authorization events (AUTHOREV) enabled, every attempt to access something which a user is not authorized to will cause an event message to be put to the SYSTEM.ADMIN.QMGR.EVENT queue. So, for example, if a user does not have access to display queues, then one authorization event message will be put to SYSTEM.ADMIN.QMGR.EVENT for each queue they cannot access every time the Queues view in WMQ Explorer is refreshed. This could result in a lot of messages, so you may want to disable AUTHOREV or take steps to handle these messages.

Note 3: If you want to look at queues with WebSphere MQ Explorer in this way, you will need to have Refresh Pack 6.0.2.0 or greater applied. A bug in the Explorer prior to this meant that the failure to display SYSTEM.AUTH.DATA.QUEUE (a queue to which it is not possible to give a non-mqm user access) prevented any queues from being displayed. This is documented more fully in APAR IC49051 (https://www-1.ibm.com/support/docview.wss?rs=171&uid=swg1IC49051)

Note 4: When I talk about the WMQ Explorer, I’m referring to the Eclipse-based Explorer that comes with WebSphere MQ version 6. I’ve not tried this on the v5.3 Windows WMQ Explorer.

Note 5: In the examples above, we used the -p option for setmqaut – specifying a specific user. This was done for simplicity but in practice using -g to specify a group is often easier to manage. See the System Administrative Guide for the full syntax.

64. Websphere MQ & DB2 MQListener

I have a system that receives a message and calls a DB2 stored procedure to process it via a db2mqlsn command (on Windows). Now I’m migrating the system to Linux and the only thing left for me to do, is to set up the db2mqls to start automatically after the MQ manager starts.

My problem is that running the command won’t return a result because it keeps running indefinitely.

Here’s part of what I got on the script (on /etc/init.d/):

su – mqm -c “cd /opt/mqm/bin; ./strmqm MYQUEUEMANAGER “
su – db2inst1 -c “cd /opt/ibm/db2/V9.1/bin; ./db2mqlsn run -config DB MYDB -config mydbconfig”

How can I set up a command call like that in the script that I have created that starts my MQ manager at boot (on /etc/init.d/)?
A: You might want to put the command into the background. At the end of the command just put a ‘&’:

Code:
runmqlsr -m MYQMGR -t tcp -p 1414 &

65. Get support from IBM for MQ5.3 for Tandem Nonstop

What’s the best way to file problem reports about version 5.3 of MQ for Tandem Nonstop systems?

I have access to IBMLINK, what is the “Software Component Id” that should be used for the Tandem-based 5.3 products? I have tried all of the numbers I have found in the documentation and in the read me files and none of them work.

A: Try using 5724A39. Also, you should try the ESR interface to IBM for the Tandem.

ESR will allow you to generate a PMR (case) but like all things, you need to be authorized by your companies IBM services coordinator.

66. Saving change impact on MQ

We are running 5.2 and 5.3. Our servers had the MS DST patches applied and the server OS time was correct; however, Eclipse was still showing times that is one hour behind.

Does daylight save change have any impact on the MQ application?

A: Customers need to ensure that the JRE being used by the eclipse that can be customized by customers is up to date by running the JTZU against the specified version that they are using. The actions that need to be taken are as follows:

1. Identify the JDK in use by eclipse. This can be done by launching the WebSphere MQ explorer and then following the menu tree:

Window ->Preferences -> Java -> Installed JREs

 A list of one or more installed JREs is displayed in the panel. One of these JREs will be “checked” indicating that it is the one that eclipse will use to run Java code (MQ Explorer in this case) against. Make a note of this location for example

C:JDKJ150 – Download and extract the appropriate JTZU from:

https://www-128.ibm.com/developerworks/java/jdk/dst/index.html

  1. Use the command and change directories to the extract location.
  2. Alter the runjtzuenv.bat file to set the location of a JVM that the tool will be launched under. For example:
  • rem set JAVA_HOME to the Java installation directory
  • set JAVA_HOME=c:jdkj142jre
  • rem set NOGUI
  • set NOGUI=false
  • rem set DISCOVERONLY
  • set DISCOVERONLY=true
  • rem set SILENTPATCH
  • set SILENTPATCH=false

This would instruct the tool to run against a JRE (in this case 1.4.2) at a location c:jdkj142jre:

  1. Launch the tool using runjtzu.bat
  2. Select ‘Interactive mode’ and click the start button
  3. Ensure customer make a note of the warning message regarding applying maintenance
  4. Enter the location of the java runtime being used by the eclipse, for example, c:jdkJ150jre (please note that ‘jre’ is needed here)
  5. Click update to begin the update process.
  6. The customer should then re-test the MQExplorer and determine if the problem persists.

67.FDC Files filling up the disk space

We are using the MQ version 5.3 with the CSD Version 5 in Windows Server 2000. For the last 2 weeks, the FDC files are being generated continuously and now have occupied the drive completely. We have deleted some old FDC to free some space.

How do I stop these FDCs’ from getting generated?

A: This one’s from IBM:

Problem: You are running WebSphere® MQ v5.3. You monitor MQ with a user-developed shell script, which runs runmqsc every 10 minutes. This script produces FDC files for probe id XC076001 and the reason code of xecX_E_CONV_NOT_SUP. These FDC files also are reporting “Cat CCSID 954, user CCSID 819”. This means that the message catalog is using CCSID 954. The FDC does not stop runmqsc or the script. The environment where the messages come from is the one issuing the runmqsc commands and is also using CCSID 819.

Cause: This problem occurs because you have LC_ALL set to blank or no value. In this case, the value of LC_ALL= will take precedence over LANG. So the default locale, English 819, is taken. Since there is no conversion table for 950 to 819 available the message display fails.

Solution: Set LC_ALL=ja and export this in a shell. Issue locale command and this should display LANG and LC_* as “ja”. Once the display shows the values correctly, issue runmqsc and check if the problem is resolved.
Also, it is suggested that you set all locale variables to the same value. In this case, either set them all to be “ja” or set all to be Japanese.
The locale output for the failing machine shows:
LANG=ja
LC_CTYPE=japanese
LC_NUMERIC=”ja”
LC_TIME=”ja”
LC_COLLATE=”ja”
LC_MONETARY=”ja”
LC_MESSAGES=japanese
LC_ALL=

68. Connection B/W MQ running on SOLARIS and Z/OS

We installed MQ Server 5.3 on a SUN Solaris Host. How would I create a connection b/w Solaris MQ and Mainframe MQ? Is there any file in which I need to give the IP address of remote host?

A: You need to create MQ channels between the two queue managers. Two manuals to look at MQ Intercommunications and MQ Script Command Reference.

Briefly, channels come in pairs; one Sender and one Receiver, for example:

Messages flow one way on a channel. If you need messages to flow in the other direction, you will need to create a second pair of channels. Sender channels send messages from a transmission queue (xmitq). The QRemote definition specifies the name of the xmit queue. The programmer opens the QRemote definition.

To get messages from SUN to z/OS, create:

On the SUN qmgr: one Sender channel from SUN to z/OS. Let’s call it SUN.ZOS. On the Sender channel definition, you specify ipaddress (port) of the z/OS qmgr and listener.

On z/OS: one Receiver channel from SUN to z/OS. Exact same name: SUN.ZOS.

To get messages from z/OS to SUN, create the inverse channel pair. Let’s call it ZOS.SUN:

On z/OS: one Sender channel from z/OS to SUN, specifying SUN qmgr ipaddress (port).

On SUN: one Receiver channel from z/OS to SUN. Exact same channel name: ZOS.SUN.

Examples for each platform type are in the Intercommunications manual.

You will need to have IP running on both SUN and z/OS and you will need to have listeners running on both, as well.

69. Unsubscribing topic with command

We have a situation where we need to unsubscribe a topic in the Publish-Subscribe setup. The same is not working through our program. Can we issue any command that can be used to unsubscribe a topic or all the topics?
A: Send an “unsubscribe” message with RFHUtil or similar. Another option is to delete the subscription through the broker admin interface.

70. Same message consumed by two different application

We have three qmgrs QM1, QM2 & QM3 which are connected to three applications App1 to QM1, App2 to QM2, & App3 to QM3. The requirement is to have messages sent by App1 to QM2 (Distributed Queuing). This message has to be consumed by App2 from QM2 and also the same message has to be sent to QM3 to be consumed by App3.

The app team informed us that there won’t be any change in the code so we have to get this done only with MQ. Is this achievable using MQ?

A: Try the mirrorq exit. Please bear in mind the mirrorq exit is sample code & not necessarily production strength. If you’re going to use this over anything other than the short term, review it and be sure you’re confident of its robustness and your ability to support it.

71. MQ update DB on another computer

From Machine A, a client program sends a request to the MQ server in Machine B. Now, that computer updates the DB situated in another Machine C. Is this possible only with triggering?
A: Your scenario relies on Machine A being able to place a request message on Machine B, hence you’d need an MQ client connection between A and B or server-side channels to carry the message. Machine B must be able to access the database on Machine C, so this implies a client link between the two machines. Unless they have replicated databases, RPC links, piped data transfer, or an MQ link running PM4Data.
You would also need a triggered application on Machine B unless the application on Machine B was written to be long-running or there wasn’t an application on Machine B. This could only be written in Java or C or a language with a supported environment on Machine B unless there wasn’t an application at all.

72. SSL certificate selection

Ans: I am having a queue manager to whom 10 different applications connect. I want to make them connect over SSL svrconn channels and for them to represent different unique certificates. So all 10 application key repositories will have the same queue manager certificate but my queue manager key repository will have 10 different certificates, one from each application.
My Q. is how the queue manager will know which certificate to use for a handshake when a connection request comes?
A: QMGR will use their cert from Keystore which alias name is Ibmwebspheremq during a handshake.
Then in your configuration QMGR compares the sent application public certificate with certificates from Keystore.
Consider using standard PKI with CA rather than a self-signed cert.

73. Max message size overhead

What is the overhead on MQ for having a large value for maximum message length in a queue definition?

For example, if I define the maximum message length to say 10MB but the maximum message length is only initially set at 1MB.

Can this affect any performance on the settings elsewhere?

A: The space used to hold the value for MaxMsgLen is a constant; it’s the same no matter what number is used for MaxMsgLen.

The only way that, for example, setting the MaxMsgLn for all queues, channels, and qmgrs to the maximum possible will have any performance impact is if your logs are not sized to handle that size of message AND someone actually SENDS a big message.

Set it to the largest value you can possibly handle, and then you don’t have to worry about changing it every time an application needs a bigger value. Setting the MaxMsgLn doesn’t affect anything else. Sending a large message does.
Max Message length is only a safety feature to not receive unexpectedly large messages.

74. What is IBM MQ Series? What is the significance of the MQ Series?

  1. A middleware from IBM
  2. It has runtime managers such as Queue Managers and Queues
  3. A queue is an object which holds messages of various formats – XML/text/byte
  4. Queue manager maintains and manages objects like Queues, channels
  5. Various listener applications listen to these queues for grabbing the messages, followed by processing these messages
  6. Java Messaging Service is one of the standards provided by JEE specification for asynchronous messaging
  7. The queues can be defined in JEE container and send messages on these queues
  8. Message Driven Bean can be configured for listening to the JMS queues
  9. When a message is on the JMS queue, the corresponding MDB’s onMessage() method is invoked and the message processing can be done

Significance of Websphere MQ Series:

  1. WebSphere MQ will significantly improve the flow of information across an enterprise
  2. The message is placed and adjusted for dynamic business requirements
  3. MQ series reduce maintenance, integration costs and acts as a bridge to various technologies
  4. MQ Series reduces costs and all the disruptions are processed from data loss
  5. Allows ongoing maintenance efforts through universal service delivery
  6. Security breaches are eliminated and ensure compliance through message and transaction integrity

75. What is a Message and what does it contain?

  1. A message is a string of bytes that has a meaningful usage in applications
  2. Messages are utilized to transfer information across applications
  3. The applications can run on the same or on different platforms

Websphere MQ messages contain:

  1. Application data: The application’s content and data are defined by the application programs which use it.
  2. Message Descriptor: The message is identified by the message descriptor and contains additional control information, like the type of message and priority assigned to the message

76. How to define a buffer pool for holding messages in main storage? Explain

  1. The buffer pool is defined by using DEFINE BUFFPOOL
  2. DEFINE BUFFPOOL can be issued only from CSQINP1 data set
  3. DISPLAY USAGE TYPE(PAGESET) can be used for displaying buffer pool information
  4. The synonym DEF BP can also be used instead of DEFINE BUFFPOOL

Example:

  • DEFINE BUFFPOOL
  • BUFFERS(1000)
  • DEFINE BUFFPOOL(buf-pool-id)
  • BUFFERS(integer)
  1. Parameter descriptions
    (buf-pool-id) Buffer pool identifier, and a mandatory entry
  2. An integer in the range from zero through 15.
    BUFFERS(integer)
  3. The integer represents the number of 4096-byte buffers

77. What is the Telemetry Capabilities?

  1. Telemetry enables Remote sensors, smart meters, etc., to be easily connected with the existing applications and services
  2. Telemetry provides messaging technique for optimizing the needs of sensor networks
  3. Decision-makers can focus on significant data and events
  4. It enables responses of rapid and proactive nature for current situations
  5. Network traffic is reduced and responsiveness increases by only sending significant data and events
  6. It encourages various device manufacturers to enable their sensors that are ready to connect into 7. IBM connectivity solutions
  7. Enables the custom implementation of messaging that is device-side for connecting unusual devices
  8. Optimizes the use of the network to lower the traffic
  9. The pay-per-byte costs can be reduced in satellite networks

78. What are the Integration and supported environments in IBM MQ?

  1. IBM MQ supports virtual integration
  2. Supports more than 80 platform configurations, including z/OS support
  3. Integrates with CICS, IMS, DB2, Microsoft .Net, and JEE environments.
  4. Supports Message Queue Interface and Industry standards such as JMS interface along with integrated public-and-subscribe support
  5. Internet secure communication is supported with industry-standard SSL
  6. IBM MQ supports IP V6
  7. Awarded Common Criteria certification
  8. Supports end-to-end governance with Extended Security Edition

79. Mention some rules for using MQSC commands.

  1. Each command of MQSC starts with a primary parameter, followed by a secondary parameter
  2. The name or generic name of the object should be followed by a secondary parameter
  3. The keywords, parentheses, and values could be separated by an unlimited number of blanks and commas
  4. At least one blank immediately preceding each parameter is mandatory, except on z/OS
  5. Blanks enclosed within a pair of quotations marks are significant
  6. Repeated parameters are not allowed
  7. A string can contain blanks, lowercase alphabets, or special characters other than period(.), forward-slash(/), underscore(_) percent sign(%) must be enclosed in a single quote
  8. A blank pair of parenthesis is invalid without significant information enclosed in between
  9. Keywords are not case sensitive

80. What is QueueManager in IBM WebSphere MQ? What does QueueManager do?

QueueManageris the primary component of WebSphere MQ or WMQ. the queue manager is responsible for storing and routing messages to other Queue Manager within MQ and it also communicates with the outside world e.g. Java program or any other MQ client.

81. What is Channel in IBM WebSphere MQ?

In WebSphere MQ or WMQ, Queue Manager uses the channel to transmit messages to other QueueManager. Channel carries one-way traffic in MQ Series (i.e. channels are unidirectional). You can have either sending channel or receiving channel in MQ.

82. What is the dead letter queue in IBM MQ Series?

Dead letter Queue in WebSphere MQ is a queue that is used by QueueManager to archive messages for a non-existent queue. For example, QueueManagerQMGR receives a message for queue ABC and if it didn’t exist on that QueueMangaer then the message will be routed to the dead letter queue.

83. What is the CCDT file on WebSphere MQ or WMQ?

CCDT file or Client Channel Definition table is a binary file that contains connection details required by MQ clients e.g. Java application using JMS to connect to MQ Server. In order to connect to MQ Server, MQ clients need MQ Server hostname, MQ Server port name, and server channel name. All these details are encapsulated in the CCDT file named AMQCLCHL.TAB. In order to create MQ Connection, MQ clients need the location of this file, which is provided as a configuration. most MQ errors come either with incorrect CCDT files.

84. What is SSLPEER in IBM Websphere MQ?

Another interesting and frequently asked WebSphere MQ Interview Q. You can easily answer this MQ Q. if you connected MQ via SSL. SSLPEER is a String usually DN (Distinguished Name) of MQ Client which connects to QueueManager securely using QueueManager. This is a mechanism WMQ uses to identify clients. In the case of Java or JMS client, SSLPEER is DN of client certificate stored in its keyStore and sent to the server during SSL handshake.

85. What is the difference between the dead letter queue and backout queue in Websphere MQ?

This is a follow Q. of previous MQ interview Q. “What is dead letter queue in MQ Series”. As we have seen that dead letter queue is used to store messages which are received for the nonexistent queue. On the other hand, backout queues are application-specific queues. If the MQ client is not able to process the message and ask for redelivery, the message is redelivered to the client with the incremented delivery count. Once this deliveryCountcrossed a configured threshold message is moved to the back-out queue for later processing or error handling. In short if MQ Series are not able to deliver a message to the client after a preconfigured attempt, WMQ moves the message to the backout queue.

86. What is the difference between binding connection and client Connection?

This MQ Interview Q. is not common or frequently asked, but good to know. If MQ clients sit on the same physical server where QueueManager is located then it can create a binding connection which is relatively faster than client connection, which is usually created by MQ clients residing on the same network but not the same host. Most of the application uses MQ client connection to connect QueueMangaer, which is easy and flexible.

87. What is the difference between a local queue and a remote queue in WMQ?

Rather simple and fact-based MQ Series interview Q. This is asked to see whether a candidate is familiar with MQ Series terminology or not. In WebSphere MQ, local queues are queue on the same queue manager while remote queue refers to queue on different QueueManager.

88. Which WebSphere MQ version have you worked on? What is the latest IBM WebSphere MQ version?

This MQ interview Q. is more to know that which version of MQ have you worked upon, do you familiar with any issue with that particular version or many major changes to the previous or next version, etc. Based upon your answer, you may expect some follow-up Q.s. By the way, the current version of WMQ is WebSphere MQ 7.5 but it always good to check IBM’s MQ website for the latest version.

89. Apart from WebSphere MQ, have you used any other Message Oriented Middleware (MOM) or any other MQ Series provider?

I like this MQ Interview Q. to ask because many times having experience of one or more Messaging technology or Messaging Middle-ware is good. As I said earlier Tibco RV, Tibco EMS, and MQ Series are some of the popular messaging technology used in Java applications. On the MQ front, there are a couple of more MQ providers e.g. Sonic MQ and Active MQ.

Active MQ is free and from Apache software foundation, which is easy to install and use. You can use Active MQ for your development and test environment. it also provides a useful Queue browser to keep track of Queues and the number of message on it.

Tuesday, April 25, 2023

Java8.0

 Java 8.0 IV

1. Describe the newly added features in Java 8?

Here are the newly added features of Java 8:

Feature Name Description
Lambda expression A function that can be shared or referred to as an object.
Functional Interfaces Single abstract method interface.
Method References Uses function as a parameter to invoke a method.
Default method It provides an implementation of methods within interfaces enabling 'Interface evolution' facilities.
Stream API Abstract layer that provides pipeline processing of the data.
Date Time API New improved joda-time inspired APIs to overcome the drawbacks in previous versions
Optional Wrapper class to check the null values and helps in further processing based on the value.
Nashorn, JavaScript Engine An improvised version of JavaScript Engine that enables JavaScript executions in Java, to replace Rhino.

2. In which programming paradigm Java 8 falls?

  • Object-oriented programming language.
  • Functional programming language.
  • Procedural programming language.
  • Logic programming language

3. What are the significant advantages of Java 8?

  • Compact, readable, and reusable code.
  • Less boilerplate code.
  • Parallel operations and execution.
  • Can be ported across operating systems.
  • High stability.
  • Stable environment.
  • Adequate support
You can download a PDF version of Java 8 Interview Questions.

4. What is MetaSpace? How does it differ from PermGen?

JVM

PremGen: MetaData information of classes was stored in PremGen (Permanent-Generation) memory type before Java 8. PremGen is fixed in size and cannot be dynamically resized. It was a contiguous Java Heap Memory.

MetaSpace: Java 8 stores the MetaData of classes in native memory called 'MetaSpace'. It is not a contiguous Heap Memory and hence can be grown dynamically which helps to overcome the size constraints. This improves the garbage collection, auto-tuning, and de-allocation of metadata.

5. What are functional or SAM interfaces?

Functional Interfaces are an interface with only one abstract method. Due to which it is also known as the Single Abstract Method (SAM) interface. It is known as a functional interface because it wraps a function as an interface or in other words a function is represented by a single abstract method of the interface.

Functional interfaces can have any number of default, static, and overridden methods. For declaring Functional Interfaces @FunctionalInterface annotation is optional to use. If this annotation is used for interfaces with more than one abstract method, it will generate a compiler error.

@FunctionalInterface // Annotation is optional 
public interface Foo() { 
// Default Method - Optional can be 0 or more 
public default String HelloWorld() { 
return "Hello World"; 
} 
// Static Method - Optional can be 0 or more 
public static String CustomMessage(String msg) { 
return msg; 
} 
// Single Abstract Method 
public void bar(); 
} 

public class FooImplementation implements Foo { 
// Default Method - Optional to Override
@Override
public default String HelloWorld() { 
return "Hello Java 8"; 
} 
// Method Override
@Override
public void bar() {
	System.out.println(“Hello World”);
} 
} 

public static void main(String[] args) { 

FooImplementation fi = new FooImplementation();
System.out.println(fi.HelloWorld());
System.out.println(fi.CustomMessage(“Hi”));
fi.bar();
}

6. Can a functional interface extend/inherit another interface?

A functional interface cannot extend another interface with abstract methods as it will void the rule of one abstract method per functional interface. E.g:

interface Parent { 
public int parentMethod(); 
} 
@FunctionalInterface // This cannot be FunctionalInterface 
interface Child extends Parent { 
public int childMethod(); 
// It will also extend the abstract method of the Parent Interface 
// Hence it will have more than one abstract method 
// And will give a compiler error 
}

It can extend other interfaces which do not have any abstract method and only have the default, static, another class is overridden, and normal methods. For eg:

interface Parent { 
public void parentMethod(){ 
System.out.println("Hello"); 
} 
} 
@FunctionalInterface 
interface Child extends Parent { 
public int childMethod(); 
}

7. What is the default method, and why is it required?

A method in the interface that has a predefined body is known as the default method. It uses the keyword default. default methods were introduced in Java 8 to have 'Backward Compatibility in case JDK modifies any interfaces. In case a new abstract method is added to the interface, all classes implementing the interface will break and will have to implement the new method. With default methods, there will not be any impact on the interface implementing classes. default methods can be overridden if needed in the implementation. Also, it does not qualify as synchronized or final.

@FunctionalInterface // Annotation is optional 
public interface Foo() { 
// Default Method - Optional can be 0 or more 
public default String HelloWorld() { 
return "Hello World"; 
} 
// Single Abstract Method 
public void bar(); 
}

8. What are static methods in Interfaces?

Static methods, which contains method implementation is owned by the interface and is invoked using the name of the interface, it is suitable for defining the utility methods and cannot be overridden.

9. What are some standard Java pre-defined functional interfaces?

Some of the famous pre-defined functional interfaces from previous Java versions are Runnable, Callable, Comparator, and Comparable. While Java 8 introduces functional interfaces like Supplier, Consumer, Predicate, etc. Please refer to the java.util.function doc for other predefined functional interfaces and its description introduced in Java 8.

Runnable: use to execute the instances of a class over another thread with no arguments and no return value. 

Callable: use to execute the instances of a class over another thread with no arguments and it either returns a value or throws an exception.

Comparator: use to sort different objects in a user-defined order

Comparable: use to sort objects in the natural sort order

10. What are the various categories of pre-defined function interfaces?

Function: To transform arguments in returnable value.

Predicate: To perform a test and return a Boolean value.

Consumer: Accept arguments but do not return any values.

Supplier: Do not accept any arguments but return a value. 

Operator: Perform a reduction type operation that accepts the same input types.

11. What is the lambda expression in Java and How does a lambda expression relate to a functional interface?

Lambda expression is a type of function without a name. It may or may not have results and parameters. It is known as an anonymous function as it does not have type information by itself. It is executed on-demand. It is beneficial in iterating, filtering, and extracting data from a collection.

As lambda expressions are similar to anonymous functions, they can only be applied to the single abstract method of Functional Interface. It will infer the return type, type, and several arguments from the signature of the abstract method of functional interface.

Java 8 Interview Questions for Experienced

12. What is the basic structure/syntax of a lambda expression?

FunctionalInterface fi = (String name) -> { 
System.out.println("Hello "+name); 
return "Hello "+name; 
}

Lambda expression can be divided into three distinct parts as below:

1. List of Arguments/Params:

(String name) 

A list of params is passed in () round brackets. It can have zero or more params. Declaring the type of parameter is optional and can be inferred for the context. 

2. Arrow Token:

-> 
Arrow token is known as the lambda arrow operator. It is used to separate the parameters from the body, or it points the list of arguments to the body. 3. Expression/Body:

{ 
System.out.println("Hello "+name); 
return "Hello "+name; 
}

A body can have expressions or statements. {} curly braces are only required when there is more than one line. In one statement, the return type is the same as the return type of the statement. In other cases, the return type is either inferred by the return keyword or void if nothing is returned.

13. What are the features of a lambda expression?

Below are the two significant features of the methods that are defined as the lambda expressions: 

  • Lambda expressions can be passed as a parameter to another method. 
  • Lambda expressions can be standalone without belonging to any class.

14. What is a type interface?

Type interface is available even in earlier versions of Java. It is used to infer the type of argument by the compiler at the compile time by looking at method invocation and corresponding declaration.

15. What are the types and common ways to use lambda expressions?

A lambda expression does not have any specific type by itself. A lambda expression receives type once it is assigned to a functional interface. That same lambda expression can be assigned to different functional interface types and can have a different type.

For eg consider expression s -> s.isEmpty() :

Predicate<String> stringPredicate = s -> s.isEmpty(); 
Predicate<List> listPredicate = s -> s.isEmpty();
Function<String, Boolean> func = s -> s.isEmpty();
Consumer<String> stringConsumer = s -> s.isEmpty();

Common ways to use the expression

Assignment to a functional Interface —> Predicate<String> stringPredicate = s -> s.isEmpty();
Can be passed as a parameter that has a functional type —> stream.filter(s -> s.isEmpty())
Returning it from a function —> return s -> s.isEmpty()
Casting it to a functional type —> (Predicate<String>) s -> s.isEmpty()

16. In Java 8, what is Method Reference?

Method reference is a compact way of referring to a method of functional interface. It is used to refer to a method without invoking it. :: (double colon) is used for describing the method reference. The syntax is class::methodName

For e.g.: 

Integer::parseInt(str) \\ method reference

str -> Integer.ParseInt(str); \\ equivalent lambda



17. What does the String::ValueOf expression mean?

It is a static method reference to method Valueof() of class String. It will return the string representation of the argument passed.

18. What is an Optional class?

Optional is a container type which may or may not contain value i.e. zero(null) or one(not-null) value. It is part of java.util package. There are pre-defined methods like isPresent(), which returns true if the value is present or else false and the method get(), which will return the value if it is present.

static Optional<String> changeCase(String word) {
if (name != null && word.startsWith("A")) {
   return Optional.of(word.toUpperCase());
  }
else {
return Optional.ofNullable(word); // someString can be null
}
}
Optional Class

19. What are the advantages of using the Optional class?

Below are the main advantage of using the Optional class: 

It encapsulates optional values, i.e., null or not-null values, which helps in avoiding null checks, which results in better, readable, and robust code It acts as a wrapper around the object and returns an object instead of a value, which can be used to avoid run-time NullPointerExceptions.

20. What are Java 8 streams?

A stream is an abstraction to express data processing queries in a declarative way. 

A Stream, which represents a sequence of data objects & series of operations on that data is a data pipeline that is not related to Java I/O Streams does not hold any data permanently.
The key interface is java.util.stream.Stream<T>. It accepts Functional Interfaces so that lambdas can be passed. Streams support a fluent interface or chaining. Below is the basic stream timeline marble diagram:

Java 8 Streams

21. What are the main components of a Stream?

Components of the stream are:

  • A data source
  • Set of Intermediate Operations to process the data source
  • Single Terminal Operation that produces the result
Components of Stream

22. What are the sources of data objects a Stream can process?

A Stream can process the following data:

  • A collection of an Array.
  • An I/O channel or an input device.
  • A reactive source (e.g., comments in social media or tweets/re-tweets) 
  • A stream generator function or a static factory.

23. What are Intermediate and Terminal operations?

Intermediate Operations:

  • Process the stream elements.
  • Typically transforms a stream into another stream.
  • Are lazy, i.e., not executed till a terminal operation is invoked.
  • Does internal iteration of all source elements.
  • Any number of operations can be chained in the processing pipeline.
  • Operations are applied as per the defined order.
  • Intermediate operations are mostly lambda functions.

Terminal Operations:

  • Kick-starts the Stream pipeline.
  • used to collect the processed Stream data.
int count = Stream.of(1, 2, 3, 4, 5)
.filter(i -> i <4) // Intermediate Operation filter
.count(); // Terminal Operation count

24. What are the most commonly used Intermediate operations?

Filter(Predicate<T>) - Allows selective processing of Stream elements. It returns elements that are satisfying the supplied condition by the predicate.

map(Funtion<T, R>) - Returns a new Stream, transforming each of the elements by applying the supplied mapper function.= sorted() - Sorts the input elements and then passes them to the next stage.

distinct() - Only pass on elements to the next stage, not passed yet.

limit(long maxsize) - Limit the stream size to maxsize.

skip(long start) - Skip the initial elements till the start.

peek(Consumer) - Apply a consumer without modification to the stream.

flatMap(mapper) - Transform each element to a stream of its constituent elements and flatten all the streams into a single stream.

25. What is the stateful intermediate operation? Give some examples of stateful intermediate operations.

To complete some of the intermediate operations, some state is to be maintained, and such intermediate operations are called stateful intermediate operations. Parallel execution of these types of operations is complex.

For Eg: sorted() , distinct() , limit() , skip() etc. 

Sending data elements to further steps in the pipeline stops till all the data is sorted for sorted() and stream data elements are stored in temporary data structures.

26. What is the most common type of Terminal operations?

  • collect() - Collects single result from all elements of the stream sequence.
  • reduce() - Produces a single result from all elements of the stream sequence
    • count() - Returns the number of elements on the stream.
    • min() - Returns the min element from the stream.
    • max() - Returns the max element from the stream.
  • Search/Query operations
    • anyMatch() , noneMatch() , allMatch() , ... - Short-circuiting operations.
    • Takes a Predicate as input for the match condition.
    • Stream processing will be stopped, as and when the result can be determined.
  • Iterative operations
    • forEach() - Useful to do something with each of the Stream elements. It accepts a consumer.
    • forEachOrdered() - It is helpful to maintain order in parallel streams.

27. What is the difference between findFirst() and findAny()?

findFirst() findAny()
Returns the first element in the Stream Return any element from the Stream
Deterministic in nature Non-deterministic in nature

28. How are Collections different from Stream?

Collections are the source for the Stream. Java 8 collection API is enhanced with the default methods returning Stream<T> from the collections.

Collections Streams
Data structure holds all the data elements No data is stored. Have the capacity to process an infinite number of elements on demand
External Iteration Internal Iteration
Can be processed any number of times Traversed only once
Elements are easy to access No direct way of accessing specific elements
Is a data store Is an API to process the data

29. What is the feature of the new Date and Time API in Java 8?

  • Immutable classes and Thread-safe 
  • Timezone support
  • Fluent methods for object creation and arithmetic
  • Addresses I18N issue for earlier APIs
  • Influenced by popular joda-time package
  • All packages are based on the ISO-8601 calendar system

30. What are the important packages for the new Data and Time API?

  • java.time
    • dates 
    • times 
    • Instants 
    • durations 
    • time-zones 
    • periods
  • Java.time.format
  • Java.time.temporal
  • java.time.zone

31. Explain with example, LocalDate, LocalTime, and LocalDateTime APIs.

LocalDate

  • Date with no time component
  • Default format - yyyy-MM-dd (2020-02-20)
  • LocalDate today = LocalDate.now();  // gives today’s date
  • LocalDate aDate = LocalDate.of(2011, 12, 30); //(year, month, date)

LocalTime

  • Time with no date with nanosecond precision
  • Default format - hh:mm:ss:zzz (12:06:03.015) nanosecond is optional
  • LocalTime now = LocalTime.now();  // gives time now
  • LocalTime aTime2 = LocalTime.of(18, 20, 30); // (hours, min, sec)

LocalDateTime

  • Holds both Date and Time
  • Default format - yyyy-MM-dd-HH-mm-ss.zzz (2020-02-20T12:06:03.015)
  • LocalDateTime timestamp = LocalDateTime.now(); // gives timestamp now
  • //(year, month, date, hours, min, sec)
  • LocalDateTime dt1 = LocalDateTime.of(2011, 12, 30, 18, 20, 30);

32. Define Nashorn in Java 8

Nashorn is a JavaScript processing engine that is bundled with Java 8. It provides better compliance with ECMA (European Computer Manufacturers Association) normalized JavaScript specifications and better performance at run-time than older versions.

33. What is the use of JJS in Java 8?

As part of Java 8, JJS is a command-line tool that helps to execute the JavaScript code in the console. Below is the example of CLI commands:

JAVA>jjs
jjs> print("Hello, Java 8 - I am the new JJS!")
Hello, Java 8 - I am the new JJS!
jjs> quit()
>>

Docker Swarn

Docker is a tool intended to make the process of creating, deploying and running applications easier by using container based virtualization...